Part Number Hot Search : 
DTA12 100K1 AXHV5005 M30201 A001M12 10012 14S12 M12541PE
Product Description
Full Text Search
 

To Download ST63E156D1 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  st63140, st63146 st63126, st63156 data sheet 1 st edition october 1993
use in life support devices or systems must be expressly authorized. sgs-thomson products are not authorized for use as critical components in life support devices or sys- tems without the express written approval of sgs-thomson microelectronics. as used herein : 1. life support devices or systems are those which (a) are intended for surgical implant into the body, or (b) support or sustain life, and whose failure to perform, when prop- erly used in accordance with instructions for use pro- vided with the product, can be reasonably expected to result in significant injury to the user. 2. a critical component is any component of a life support device or system whose failure to perform can reason- ably be expected to cause the failure of the life support device or system, or to affect its safety or effectiveness.
st631xx datasheet index pages st63140, st63142 st63126, st63156 .................................... 1 general description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 pindescription ......................................... 5 st631xx core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............. 7 memory spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...... 10 stack space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 interrupt . . . .......................................... 16 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 wait & stop modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 on-chip clock oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 input/output ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 hardware activated digital watchdog function . . . . . . ............. 30 serial peripheral interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 14-bit voltage synthesis tuning peripheral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 6-bit pwm d/a converter and 62.5 khz output function . . . . . . . . . . . . . . . . 41 afc a/d input, keyboard inputs and bandswith outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 infrared input (irin) . . .................................... 44 on-screen display (osd) . . . . . ............................... 45 software description . . . . . ................................ 54 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . ............. 59 eeprom information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 ordering information table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 st63e140/t140, e142/t142 st63e126/t126, e156/t156 ............................. 67 general description . . . . . . . . . . . . .......................... 69 pindescription ......................................... 71 eprom/otp description. . . . . . . . . . . . . . . . . . ................... 74 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 eeprom information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 ordering information table . . . . . . . . . . . . . . . . . . . . ............. 82 ?
?
? 8-bit hcmos mcus for tv frequency & voltage synthesis with osd st63140, st63142 st63126, st63156 4.5 to 6v operating range 8mhz maximum clock frequency user program rom: 7948 bytes reserved test rom: 244 bytes data rom: user selectable size data ram: 256 bytes data eeprom: 128 bytes 40-pin dual in line plastic package for the st63126, 156 28-pin dual in line plastic package for the st63140, 142 up to 18 software programmable general pur- pose inputs/outputs, including 8 direct led driving outputs 3 inputs for keyboard scan (kby0-2) up to 4 high voltage outputs (bsw0-3) two timers each including an 8-bit counter with a 7-bit programmable prescaler digital watchdog function serial peripheral interface (spi) supporting s-bus/ i 2 c bus and standard serial protocols up to four 6-bit pwm d/a converters 62.5khz output pin 14 bit counter for voltage synthesis tuning (st63156, st63140) afc a/d converter with 0.5v resolution four interrupt vectors (irin/nmi, timer 1 & 2, vsync.) on-chip clock oscillator 5 lines by 15 characters on-screen display generator with 128 characters (2 banks) all rom types are supported by pin-to-pin eprom and otp versions. the development tool of the st631xx microcon- trollers consists of the st63tvs-emuemulation and development system to be connected via a standard rs232 serial line to an ms-dos per- sonal computer. this is preliminary information from sgs-thomson. details are subject to change without notice. october 1993 preliminary data device rom (bytes) tun. i/o pins package st63126 8k fs 12 pdip40 st63156 8k vs 11 pdip40 st63140 8k vs 6 pdip28 st63142 8k fs 6 pdip28 device summary 1 pdip28 1 pdip40 (ordering information at the end of the datasheet) 1/82
figure 1. st63126, 156 pin configuration figure 2. st63140, 142 pin configuration da0 da3 pc5 (r) irin out1 da1 da2 pa1 (scl) pb5 (sda) pb6 12 11 10 9 (sen) pb7 kby2 kby kby0 8 7 6 5 bsw3 bsw2 bsw0 4 3 2 1 pa3 pa2 21 22 pa4 reset oscin oscout pc1 23 24 25 26 27 28 pa5 pa6 test afc (vsync) pb2 (hsync) pb3 osdoscin osdoscout 29 30 31 32 33 34 35 pc6 (g) pc7 (b) 36 37 38 39 40 va00282 v dd 13 14 15 16 17 18 19 20 v ss 1 bsw1 pc3 (blank) pc2 (on/off) (1) pc0 da0 da3 pc5 (r) irin out1 da1 da2 pa1 (scl) pb5 (sda) pb6 12 11 10 9 (sen) pb7 kby2 kby kby0 8 7 6 5 bsw3 bsw2 bsw0 4 3 2 1 pa3 pa2 21 22 pa4 reset oscin oscout pc1 23 24 25 26 27 28 pa5 pa6 test afc (vsync) pb2 (hsync) pb3 osdoscin osdoscout 29 30 31 32 33 34 35 pc6 (g) pc7 (b) 36 37 38 39 40 va00288 v dd 13 14 15 16 17 18 19 20 v ss 1 bsw pc3 (blank) pc2 (on/off) vs (1) bsw0 bsw1 bsw2 kby0 kby1 kby2 osdoscout osdoscin pb3 (hsync) pb2 (vsync) afc test pa4 v da0 out1 vs pc6 (g) pc4 pc3 (blank) pc2 oscout oscin reset pa0 pa1 pa2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 vr001389 dd v ss (1) bsw0 bsw1 bsw2 kby0 kby1 kby2 osdoscout osdoscin pb3 (hsync) pb2 (vsync) afc test pa4 v v da0 out1 irin pc6 (g) pc5 (r) pc4 pc2 oscout oscin reset pa0 pa1 pa2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 vr001390 dd ss (1) note 1. this pin is also the v pp input for eprom based devices st63126 st63156 st63140 st63142 note 1. this pin is also the v pp input for eprom based devices ? st63140,142,126,156 2/82
general description the st63140, 142, 126, 156 microcontrollers are members of the 8-bit hcmos st631xx family, a series of devices specially oriented to tv applica- tions. different rom size and peripheral configura- tions are available to give the maximum application and cost flexibility. all st631xx members are based on a building block approach: a common core is surrounded by a combination of on-chip pe- ripherals (macrocells) available from a standard li- brary. these peripherals are designed with the same core technology providing full compatibility and short design time. many of these macrocells are specially dedicated to tv applications. the macrocells of the st631xx family are: two timer peripherals each including an 8-bit counter with a 7-bit software programmable prescaler (timer), a digital hardware activated watchdog function (dhwd), a 14-bit voltage synthesis tuning periph- eral, a serial peripheral interface (spi), up to four 6-bit pwm d/a converters, an afc a/d converter with 0.5v resolution, an on-screen display (osd) with 15 characters per line and 128 characters (in two banks each of 64 characters). in addition the following memory resources are available: pro- gram rom (7k), data ram (256 bytes), eeprom (128 bytes). refer to pin configuration figures and to st631xx device summary (table 1) for the definition of st631xx family members and a summary of differ- ences among the different types. ? st63140,142,126,156 3/82
stack level 1 stack level 2 stack level 3 stack level 4 stack level 5 stack level 6 pc d/aoutputs timer 2 ir interrupt input test timer 1 port c port b port a vs output & afc input on-screen display digital watchdog/timer serial peripheral interface v dd v ss oscin osdoscin osdoscout oscout reset r, g, b, blank hsync (pb3) vsync (pb2) vr01753e pa0 - pa7 * da0 - da3 irin/nmi test afc & vs * pb2 - pb7 * pc0 - pc7 * power supply oscillator reset 8-bit core user program rom 8 kbytes data rom user selectable data eeprom 128 bytes data ram 256 bytes * refer to pin configuration for additional information figure 3. st631xx block diagram device rom (bytes) ram (bytes) eeprom (bytes) i/o kby i/o bsw out afc vs d/a pack. emul. devices st63126 8k 256 128 12 3 4 yes no 4 pdip40 st63e126 st63156 8k 256 128 11 3 4 yes yes 4 pdip40 st63e156 st63140 8k 256 128 6 3 3 yes yes 1 pdip28 st6e140 st63142 8k 256 128 6 3 3 yes no 1 pdip28 st63e142 table 1. device summary ? st63140,142,126,156 4/82
pin description v dd and v ss . power is supplied to the mcu using these two pins. v dd is power and v ss is the ground connection. oscin, oscout. these pins are internally con- nected to the on-chip oscillator circuit. a quartz crystal or a ceramic resonator can be connected between these two pins in order to allow the cor- rect operation of the mcu with various stabil- ity/cost trade-offs. the oscin pin is the input pin, the oscout pin is the output pin. reset. the active low reset pin is used to start the microcontroller to the beginning of its program. test. the test pin must be held at v ss for nor- mal operation. pa0-pa7. these 8 lines are organized as one i/o port (a). each line may be configured as either an input or as an output under software control of the data direction register. port a has an open-drain (12v drive) output configuration with direct led driving capability (30ma, 1v). pb2-pb3, pb5-pb7. these lines are organized as one i/o port (b). each line may be configured as either an input with or without internal pull-up resis- tor or as an output under software control of the data direction register. pb2-pb3 have a push-pull configuration in output mode while pb5-pb7 are open-drain (5v drive). pb2 and pb3 lines are connected to the vsync and hsync control signals of the osd cell; to pro- vide the right signals to the osd these i/o lines should be programmed in input mode and the user can read aon the flyo the state of vsync and hsync signals. pb2 is also connected with the vsync interrupt. the active polarity of vsync in- terrupt signal is software controlled. the active po- larity of these synchronization input pins to the osd macrocell can be selected by the user as rom mask option. if the device is specified to have negative logic inputs, then when these signals are low the osd oscillator stops. if the device is speci- fied to have positive logic inputs, then when these signals are high the osd oscillator stops. pb5, pb6 and pb7 lines, when in output modes, are aandedo with the spi control signals. pb5 is connected with the spi clock signal (scl), pb6 with the spi data signal (sda) while pb7 is con- nected with spi enable signal (sen). pc0-pc7. these 8 lines are organized as one i/o port (c). each line may be configured as either an input with or without internal pull-up resistor or as an output under software control of the data direc- tion register. pc0-pc2, pc4 have a push-pull con- figuration in output mode while pc3, pc5-pc7 (osd signals) are open-drain (5v drive). pc3, pc5 , pc6 and pc7 lines when in output mode are aandedo with the character and blank signals of the osd cell. pc3 is connected with the osd blank signal, pc5, pc6 and pc7 with the osd r, g and b signals. the active polarity of these sig- nals can be selected by the user as rom mask op- tion. pc2 is also used as tv set on-off switch (5v drive). da0-da3. these pins are the four pwm d/a out- puts (with 32khz repetition) of the 6-bit on-chip d/a converters. the pwm function can be disabled by software and these lines can be used as general purpose open-drain outputs (12v drive). irin. this pin is the external nmi of the mcu. out1. this pin is the 62.5khz output specially suited to drive multi-standard chroma processors. this function can be disabled by software and the pin can be used as general purpose open-drain output (12v drive). bsw0-bsw3. these output pins can be used to select up to 4 tuning bands. these lines are config- ured as open-drain outputs (12v drive). kby0-kby2. these pins are input only and can be used for keyboard scan. they have cmos thresh- old levels with schmitt trigger and on-chip 100k w pull-up resistors. afc. this is the input of the on-chip 10 level com- parator that can be used to implement the afc function. this pin is an high impedance input able to withstand signals with a peak amplitude up to 12v. osdoscin, osdoscout. these are the on screen display oscillator terminals. an oscillation capacitor and coil network have to be connected to provide the right signal to the osd. vs. this is the output pin of the on-chip 14-bit volt- age synthesis tuning cell (vs). the tuning signal present at this pin gives an approximate resolution of 40khz per step over the uhf band. this line is a push-pull output with standard drive (st63140, st63156 only). ? st63140,142,126,156 5/82
pin function description da0 to da3 output, open-drain, 12v bsw0 to bsw3 output, open-drain, 12v irin input, resistive bias, schmitt trigger afc input, high impedance, 12v out1 output, open-drain, 12v kby0 to kby2 input, pull-up, schmitt trigger r,g,b, blank output, open-drain, 5v hsync, vsync input, pull-up, schmitt trigger osdoscin input, high impedance osdoscout output, push-pull test input, pull-down oscin input, resistive bias, schmitt trigger to reset logic only oscout output, push-pull reset input, pull-up, schmitt trigger input vs output, push-pull pa0-pa6 i/o, open-drain, 12v, no input pull-up, schmitt trigger, high drive pb2-pb3, pb5-pb7 i/o, push-pull, 5v, input pull-up, schmitt trigger pb5-pb7 i/o, open-drain, 5v, input pull-up, schmitt trigger pc0-pc2, pc4 i/o, push-pull, 5v, input pull-up, schmitt trigger pc3, pc5-pc7 i/o, open-drain, 5v, input pull-up, schmitt trigger v dd ,v ss power supply pins table 2. pin summary ? st63140,142,126,156 6/82
the core of the st631xx family is implemented independently from the i/o or memory configura- tion. consequently, it can be treated as an inde- pendent central processor communicating with i/o and memory via internal addresses, data, and con- trol busses. the in-core communication is ar- ranged as shown in the following block diagram figure; the controller being externally linked to both the reset and the oscillator, while the core is linked to the dedicated on-chip macrocells peripherals via the serial data bus and indirectly for interrupt pur- poses through the control registers. registers the st631xx family core has six registers and three pairs of flags available to the programmer. they are shown in figure 5 and are explained in the following paragraphs together with the pro- gram and data memory page registers. accumulator (a). the accumulator is an 8-bit general purpose register used in all arithmetic cal- culations, logical operations, and data manipula- tions. the accumulator is addressed in the data space as ram location at address ffh . accordingly, the st631xx instruction set can use the accumulator as any other register of the data space. vr001811 program rom/eprom reset opcode flag values control signals 12 flags alu a-data b-data 2 256 data space data ram / eeprom data accumulator interrupts results to data space ( write line ) 0,01 to 8mhz address / read line dedications controller rom / eprom oscin oscout address decoder program counter and 6 layer stack figure 4. st631xx core block diagram short direct addressing mode v register w register program counter six levels stack register c c c z z z normal flags interrupt flags nmi flags index register va000423 b7 b7 b7 b7 b7 b0 b0 b0 b0 b0 b0 b11 accumulator y reg. pointer x reg. pointer figure 5. st631xx core programming model st631xx core ? st63140,142,126,156 7/82
st631xx core (continued) indirect registers (x, y). these two indirect reg- isters are used as pointers to the memory locations in the data space. they are used in the register-in- direct addressing mode.these registers can be addressed in the data space as ram locations at the 80h (x) and 81h (y) addresses. they can also be accessed with the direct, short direct, or bit di- rect addressing modes. accordingly, the st631xx instruction set can use the indirect registers as any other register of the data space. short direct registers (v, w). these two regis- ters are used to save one byte in short direct ad- dressing mode. these registers can be addressed in the data space as ram locations at the 82h (v) and 83h (w) addresses. they can also be ac- cessed with the direct and bit direct addressing modes. accordingly, the st631xx instruction set can use the short direct registers as any other reg- ister of the data space. program counter (pc) the program counter is a 12-bit register that con- tains the address of the next rom location to be processed by the core. this rom location may be an opcode, an operand, or an address of operand. the 12-bit length allows the direct addressing of 4096 bytes in the program space. nevertheless, if the program space contains more than 4096 loca- tions, the further program space can be addressed by using the program rom page register. the pc value is incremented, after it is read for the address of the current instruction, by sending it through the alu, so giving the address of the next byte in the program. to execute relative jumps the pc and the offset values are shifted through the alu, where they will be added, and the result is shifted back into the pc. the program counter can be changed in the following ways: jp (jump) instruction.... pc = jump address call instruction ........... pc= call address relative branch instructions ................... pc= pc+offset interrupt........................ pc= interrupt vector reset............................ pc= reset vector ret & reti instructions............pc=pop (stack) normal instruction ........ pc = pc+1 flags (c, z) the st631xx core includes three pairs of flags that correspond to 3 different modes: normal mode, interrupt mode and non-maskable-inter- rupt-mode. each pair consists of a carry flag and a zero flag. one pair (cn, zn) is used during normal operation, one pair is used during the inter- rupt mode (ci,zi) and one is used during the not- maskable interrupt mode (cnmi, znmi). the st631xx core uses the pair of flags that corre- sponds to the actual mode: as soon as an interrupt (resp. a non-maskable-interrupt) is generated, the st631xx core uses the interrupt flags (resp. the nmi flags) instead of the normal flags. when the reti instruction is executed, the normal flags (resp. the interrupt flags) are restored if the mcu was in the normal mode (resp. in the interrupt mode) before the interrupt. should be observed that each flag set can only be addressed in its own routine (not-maskable interrupt, normal interrupt or main routine). the interrupt flags are not cleared during the context switching and so, they remain in the state they were at the exit of the last routine switching. the carry flag is set when a carry or a borrow oc- curs during arithmetic operations, otherwise it is cleared. the carry flag is also set to the value of the bit tested in a bit test instruction, and partici- pates in the rotate left instruction. the zero flag is set if the result of the last arithmetic or logical operation was equal to zero, otherwise it is cleared. the switching between these three sets is auto- matically performed when an nmi, an interrupt and a reti instructions occur. as the nmi mode is automatically selected after the reset of the mcu, the st631xx core uses at first the nmi flags. ? st63140,142,126,156 8/82
st631xxx core (continued) stack the st631xx core includes true lifo hardware stack that eliminates the need for a stack pointer. the stack consists of six separate 12-bit ram loca- tions that do not belong to the data space ram area. when a subroutine call (or interrupt request) occurs, the contents of each level is shifted into the next level while the content of the pc is shifted into the first level (the value of the sixth level will be lost). when subroutine or interrupt return occurs (ret or reti instructions), the first level register is shifted back into the pc and the value of each level is shifted back into the previous level. these two operating modes are described in figure 6. since the accumulator, as all other data space registers, is not stored in this stack the handling of this regis- ters shall be performed inside the subroutine. the stack pointer will remain in its deepest position, if more than 6 calls or interrupts are executed, so that the last return address will be lost. it will also remain in its highest position if the stack is empty and a ret or reti is executed. in this case the next instruction will be executed. when call or interrupt request occurs stack level 1 stack level 1 stack level 1 stack level 1 stack level 1 stack level 1 program counter ret or reti when occurs va000424 figure 6. stack operation ? st63140,142,126,156 9/82
program space vr001568 interrupt & reset vectors ac cumul ator wregister ram data rom window ram / eeprom banking area data space data ram bank select data rom window select vregister yregister xregister 0-63 0000h 07ffh 0800h 0ff0h 0fffh 000h 03fh 040h 070h 080h 081h 082h 083h 084h 0ffh 0c 0h rom rom stack level 1 stack level 2 stack level 3 stack level 4 stack level 5 stack level 6 program counter stack spac e figure 7. st631xx memory addressing description diagram memory spaces the mcus operate in three different memory spaces: program space, data space, and stack space. a description of these spaces is shown in the following figures. program space the program space is physically implemented in the rom and includes all the instructions that are to be executed, as well as the data required for the immediate addressing mode instructions, the re- served test area and user vectors. it is addressed thanks to the 12-bit program counter register (pc register) and so, the st631xx core can directly ad- dress up to 4k bytes of program space. neverthe- less, the program space can be extended by the addition of 2-kbyte rom banks as it is shown in figure 8 in which the 8k bytes memory is de- scribed. these banks are addressed by pointing to the 000h-7ffh locations of the program space thanks to the program counter, and by writing the appro- priate code in the program rom page register (prpr) located at address cah of the data space. because interrupts and common subrou- tines should be available all the time only the lower 2k bytes of the 4k program space are bank switched while the upper 2k bytes can be seen as program counter space 0000h 1fffh 0fffh static page page 1 0800h 07ffh page 0 page 1 static page page 2 page 3 0000h figure 8. st631xx 8k bytes program space addressing description static space. table 3 gives the codes that allow the selection of the corresponding banks. note that, from the memory point of view, the page 1 and the static page represent the same physical memory: it is only a different way of addressing the same location. on the st631xx a total of 8192 bytes of rom have been implemented; 7948 are available as user rom while 244 are reserved for testing. ? st63140,142,126,156 10/82
d7-d2. these bits are not used. prpr1-prpr0. these are the program rom banking bits and the value loaded selects the cor- responding page to be addressed in the lower part of 4k program address space as specified in table 3. this register is undefined on reset. note: only the lower part of address space has been bankswitched because interrupt vectors and com- mon subroutines should be available all the time. the reason of this structure is due to the fact that it is not possible to jump from a dynamic page to an- other, unless jumping back to the static page, changing contents of prpr, and, then, jumping to a different dynamic page. prpr1 prpr0 pc11 memory page x x 1 static page (page1) 0 0 0 page 0 0 1 0 page 1 (static page) 1 0 0 page 2 1 1 0 page 3 table 3. program rom page register coding care is required when handling the prpr as it is write only. for this reason, it is not allowed to change the prpr contents while executing inter- rupts drivers, as the driver cannot save and than restore its previous content. anyway, this opera- tion may be necessary if the sum of common rou- tines and interrupt drivers will take more than 2k bytes; in this case could be necessary to divide the interrupt driver in a (minor) part in the static page (start and end), and in the second (major) part in one dynamic page. if it is impossible to avoid the writing of this register in interrupts drivers, an im- age of this register must be saved in a ram loca- tion, and each time the program writes the prpr it writes also the image register. the image register must be written first, so if an interrupt occurs be- tween the two instructions the prpr is not af- fected. memory spaces (continued) prpr program rom page register (cah, write only) d7 d6 d5 d4 d3 d2 d1 d0 prpr0 = prog.rom select 0 prpr1 = prog.rom select 1 unused unused unused unused unused unused figure 11. program rom page register rom page device address device address (1) description page 0 0000h-007fh 0080h-07ffh 0000h-007fh 0080h-07ffh reserved user rom page 1 astatico 0800h-0f9fh 0fa0h-0fefh 0ff0h-0ff7h 0ff8h-0ffbh 0ffch-0ffdh 0ffeh-0fffh 0800h-0f9fh 0fa0h-0fefh 0ff0h-0ff7h 0ff8h-0ffbh 0ffch-0ffdh 0ffeh-0fffh user rom reserved interrupt vectors reserved nmi vector reset vector page 2 0000h-000fh 0010h-07ffh 1000h-100fh 1010h-17ffh reserved user rom page 3 0000h-000fh 0010h-07ffh 1800h-180fh 1810h-1fffh reserved user rom table 4. st631xx program rom map note 1. eprom addresses relate to the use of st63e1xx eprom emulation device. this register is undefined on reset. neither read nor single bit instructions may be used to address this register. ? st63140,142,126,156 11/82
b7 b0 000h data ram/eeprom/osd bank area 03fh 040h data rom window area 07fh x register 080h y register 081h v register 082h w register 083h 084h data ram 0bfh port a data register 0c0h port b data register 0c1h port c data register 0c2h reserved 0c3h port a direction register 0c4h port b direction register 0c5h port c direction register 0c6h reserved 0c7h interr upt option register 0c8h data rom window register 0c9h program rom page register 0cah reserved 0cbh spi data register 0cch 0cdh reserved 0d1h timer 1 prescaler register 0d2h timer 1 counter register 0d3h timer 1 status/control reg. 0d4h 0d5h reserved 0d7h watchd og register 0d8h figure 12. st631xx data space b7 b0 reserved 0d9h timer 2 prescaler register 0dah timer 2 counter register 0dbh timer 2 status control reg. 0dch 0ddh reserved 0dfh da0 data/control register 0e0h da1 data/control register 0e1h da2 data/control register 0e2h da3 data/control register 0e3h afc result register 0e4h keyboard input register 0e5h reserved 0e6h reserved 0e7h data ram bank register 0e8h bsw control register 0e9h eeprom control register 0eah spi control register 1 0ebh spi control register 2 0ech vs data register 1 0edh vs data register 2 0eeh osd charac. bank select reg. 0efh 0f0h reserved 0feh accumulator 0ffh osd control registers located in page6 of banked data ram vertical start address reg. 010h horizontalstart address reg. 011h vertical space register 012h horizontal space register 013h background colour register 014h global enable register 017h figure 13. st631xx data space (continued) memory spaces (continued) data space the instruction set of the st631xx core operates on a specific space, named data space that con- tains all the data necessary for the processing of the program. the data space allows the address- ing of ram (256 bytes for the st631xx family), eeprom (128 bytes), st631xx core/peripheral registers, and read-only data such as constants and the look-up tables. ? st63140,142,126,156 12/82
dwr data rom window register (c9h, write only) d7 d6 d5 d4 d3 d2 d1 d0 dwr0 = data rom window 0 dwr1 = data rom window 1 dwr2 = data rom window 2 dwr3 = data rom window 3 dwr4 = data rom window 4 dwr5 = data rom window 5 dwr6 = data rom window 6 unused figure 14. data rom window register data rom addressing. all the read-only data are physically implemented in the rom in which the program space is also implemented. the rom therefore contains the program to be executed and also the constants and the look-up tables needed for the program. the locations of data space in which the different constants and look-up tables are addressed by the st631xx core can be con- sidered as being a 64-byte window through which it is possible to access to the read-only data stored in the rom. this window is located from address 40h to address 7fh in the data space and allows the direct reading of the bytes from the address 000h to address 03fh in the rom. all the bytes of the rom can be used to store either instructions or read-only data. indeed, the window can be moved by step of 64 bytes along the rom in writing the appropriate code in the write-only data rom win- dow register (drwr, location c9h). the effective address of the byte to be read as a data in the rom is obtained by the concatenation of the 6 less sig- nificant bits of the address in the data space (as less significant bits) and the content of the drwr (as most significant bits). so when addressing lo- cation 40h of data space, and 0 is loaded in the drwr, the physical addressed location in rom is 00h. d7. this bit is not used. dwr6-dwr0. these are the data rom window bits thatcorrespond to the upperbits of data rom program space. this register is undefined after reset. this register is undefined on reset. neither read nor single bit instructions may be used to address this register. note. care is required when handling the drwr as it is write only. for this reason, it is not allowed to change the drwr contents while executing in- terrupts drivers, as the driver cannot save and than restore its previous content. if it is impossible to avoid the writing of this register in interrupts driv- ers, an image of this register must be saved in a ram location, and each time the program writes the drwr it writes also the image register. the im- age register must be written first, so if an interrupt occurs between the two instructions the drwr register is not affected. memory spaces (continued) data rom window register contents data space address 40h-7fh in instruction program space address 65432 0 543210 543210 read 1 6 7 8 9 10 11 0 1 vr01573b 12 1 0 data space address 59h 0 0 0 0 0 1 00 1 1 1 example: (dwr) dwr=28h 11 0000 00 00 1 rom address:a19h 11 13 01 7 0 0 figure 15. data rom window memory addressing ? st63140,142,126,156 13/82
drbr data ram bank register (e8h, write only) d7 d6 d5 d4 d3 d2 d1 d0 drbr0 = data ram bank 0 drbr1= data ram bank 0 drbr2= data ram bank 0 drbr3= data ram bank 0 drbr4= data ram bank 0 drbr5= data ram bank 0 drbr6= data ram bank 0 unused figure 16. data ram bank register memory spaces (continued) data ram/eeprom/osd ram addressing in all members of the st631xx family 64 bytes of data ram are directly addressable in the data space from 80h to bfh addresses. the additional 192 bytes of ram, the 128 bytes of eeprom , and the osd ram can be addressed using the banks of 64 bytes located between addresses 00h and 3fh. the selection of the bank is done by program- ming the data ram bank register (drbr) located at the e8h address of the data space. in this way each bank of ram, eeprom or osd ram can se- lect 64 bytes at a time. no more than one bank should be set at a time. d7. this bit is not used. drbr6, drbr5. each of these bits, when set, will select one osd ram register page. drbr4,drbr3,drbr2. each of these bits, when set, will select one ram page. drbr1,drbr0. these bits select the eeprom pages. this register is undefined after reset. neither read nor single bit instructions may be used to address this register. table 5 summarizes how to set the data ram bank register in order to select the various banks or pages. note : care is required when handling the drbr as it is write only. for this reason, it is not allowed to change the drbr contents while executing inter- rupts drivers, as the driver cannot save and than restore its previous content. if it is impossible to avoid the writing of this register in interrupts driv- ers, an image of this register must be saved in a ram location, and each time the program writes the drbr it writes also the image register. the image register must be written first, so if an in- terrupt occurs between the two instructions the drbr is not affected. drbr value selection hex. binary 01h 0000 0001 eeprom page 0 02h 0000 0010 eeprom page 1 04h 0000 0100 ram page 2 08h 000 1000 ram page 3 10h 0001 0000 ram page 4 20h 0010 0000 osd page 5 40h 0100 0000 osd page 6 table 5. data ram bank register set-up ? st63140,142,126,156 14/82
eeprom description the data space of st631xx family from 00h to 3fh is paged as described in table 5. 128 bytes of eeprom located in 2 pages of 64 bytes (pages 0, and 1, see table 5). through the programming of the data ram bank register (drbr=e8h) the user can select the bank or page leaving unaffected the way to ad- dress the static registers. the way to address the adynamico page is to set the drbr as described in table 5 (e.g. to select eeprom page 0, the drbr has to be loaded with content 01h, see data ram/eeprom/osd ram addressing for addi- tional information). bits 0 and 1 of the drbr are dedicated to the eeprom. the eeprom pages do not require dedicated in- structions to be accessed in reading or writing. the eeprom is controlled by the eeprom control register (eecr=eah). any eeprom location can be read just like any other data location, also in terms of access time. to write an eeprom location takes an average time of 5 ms (10ms max) and during this time the eeprom is not accessible by the core. a busy flag can be read by the core to know the eeprom status before trying any access. in writing the eeprom can work in two modes: byte mode (bmode) and parallel mode (pmode). the bmode is the normal way to use the eeprom and consists in accessing one byte at a time. the pmode consists in accessing 8 bytes per time. d7. not used sb. write only . if this bit is set the eeprom is disabled (any access will be meaningless) and the power consumption of the eeprom is reduced to the leakage values. d5, d4. reserved, they must be set to zero. ps. set only . once in parallel mode, as soon as the user software sets the ps bit the parallel writing of the 8 adjacent registers will start. ps is internally reset at the end of the programming procedure. note that less than 8 bytes can be written; after parallel programming the remaining undefined bytes will have no particular content. pe. write only . this bit must be set by the user program in order to perform parallel programming (more bytes per time). if pe is set and the aparallel start bito (ps) is low, up to 8 adjacent bytes can be written at the maximum speed, the content being stored in volatile registers. these 8 adjacent bytes can be considered as row, whose a7, a6, a5, a4, a3 are fixed while a2, a1 and a0 are the changing bytes. pe is automatically reset at the end of any parallel programming procedure. pe can be reset by the user software before starting the program- ming procedure, leaving unchanged the eeprom registers. bs. read only . this bit will be automatically set by the core when the user program modifies an eeprom register. the user program has to test it before any read or write eeprom operation; any attempt to access the eeprom while abusy bito is set will be aborted and the writing procedure in pro- gress completed. en . write only. this bit must be set to one in order to write any eeprom register. if the user program will attempt to write the eeprom when en= a0o the involved registers will be unaffected and the abusy bito will not be set. after reset the contentof eecr register will be 00h. notes : when the eeprom is busy (bs=a1o) the eecr can not be accessed in write mode, it is only possi- ble to read bs status. this implies that as long as the eeprom is busy it is not possible to change the status of the eeprom control register. eecr bits 4 and 5 are reserved for test purposes, and must never be set to a1o. memory spaces (continued) eecr eeprom control register (eah, read/write) d7 d6 d5 d4 d3 d2 d1 d0 en = eeprom enable bit bs = eeprom busy bit pe = parallel mode enable bit ps = parallel start bit reserved (must be set low) reserved (must be set low) sb = stand-by enable bit unused figure 17. eeprom control register ? st63140,142,126,156 15/82
additional notes on parallel mode. if the user wants to perform a parallel programming the first action should be the set to one the pe bit; from this moment the first time the eeprom will be ad- dressed in writing, the row address will be latched and it will be possible to change it only at the end of the programming procedure or by reset- ting pe without programming the eeprom. after the row address latching the core can aseeo just one eeprom row (the selected one) and any at- tempt to write or read other rows will produce er- rors. do not read the eeprom while pe is set. as soon as pe bit is set, the 8 volatile row latches are cleared. from this moment the user can load data in the whole row or just in a subset. ps set- ting will modify the eeprom registers correspond- ing to the row latches accessed after pe. for example, if the software sets pe and accesses eeprom in writing at addresses 18h,1ah,1bh and then sets ps, these three registers will be modified at the same time; the remaining bytes will have no particular content. note that pe is inter- nally reset at the end of the programming proce- dure. this implies that the user must set pe bit between two parallel programming procedures. anyway the user can set and then reset pe without performing any eeprom programming. ps is a set only bit and is internally reset at the end of the programming procedure. note that if the user tries to set ps while pe is not set there will not be any programming procedure and the ps bit will be un- affected. consequently ps bit can not be set if en is low. ps can be affected by the user set if, and only if, en and pe bits are also set to one. stack space the stack space consists of six 12 bit registers that are used for stacking subroutine and interrupt re- turn addresses plus the current program counter register. memory spaces (continued) interrupt the st631xx core can manage 4 different mask- able interrupt sources, plus one non-maskable in- terrupt source (top priority level interrupt). each source is associated with a particular interrupt vec- tor that contains a jump instruction to the related interrupt service routine. each vector is located in the program space at a particular address (see table 6). when a source provides an interrupt re- quest, and the request processing is also enabled by the st631xx core, then the pc register is loaded with the address of the interrupt vector (i.e. of the jump instruction). finally, the pc is loaded with the address of the jump instruction and the in- terrupt routine is processed. the relationship between vector and source and the associated priority is hardware fixed for the dif- ferent st631xx devices. for some interrupt sources it is also possible to select by software the kind of event that will generate the interrupt. all interrupts can be disabled by writing to the gen bit (global interrupt enable) of the interrupt option register (address c8h). after a reset, st631xx is in non maskable interrupt mode, so no interrupts will be accepted and nmi flags will be used, until a reti instruction is executed. if an interrupt is exe- cuted, one special cycle is made by the core, dur- ing that the pc is set to the related interrupt vector address. a jump instruction at this address has to redirect program execution to the beginning of the related interrupt routine. the interrupt detecting cy- cle, also resets the related interrupt flag (not avail- able to the user), so that another interrupt can be stored for this current vector, while its driver is un- der execution. if additional interrupts arrive from the same source, they will be lost. nmi can interrupt other interrupt routines at any time, while other interrupts cannot interrupt each other. if more than one interrupt is waiting for service, they are executed according to their priority. the lower the number, the higher the priority. priority is, therefore, fixed. interrupts are checked during the last cycle of an instruction (reti included). level sensitive interrupts have to be valid during this period. ? st63140,142,126,156 16/82
interrupt vectors/sources the st631xx core includes 5 different interrupt vectors in order to branch to 5 different interrupt routines. the interrupt vectors are located in the fixed (or static) page of the program space. the interrupt vector associated with the non-mask- able interrupt source is named interrupt vector #0. it is located at addresses ffch,ffdh in the pro- gram space. this vector is associated with the pc6/irin pin. the interrupt vectors located at addresses (ff6h,ff7h), (ff4h,ff5h), (ff2h,ff3h), (ff0h,ff1h) are named interrupt vectors #1, #2, #3 and #4 respectively. these vectors are associ- ated with timer 2 (#4), vsync (#2), and timer 1 (#3). interrupt vector (#1) is not used on st631xx. interrupt priority the non-maskable interrupt request has the high- est priority and can interrupt any other interrupt routines at any time, nevertheless the other inter- rupts cannot interrupt each other. if more than one interrupt request is pending, they are processed by the st631xx core according to their priority level: vector #1 has the higher priority while vector #4 the lower. the priority of each interrupt source is hard- ware fixed. interrupt option register the interrupt option register (ior register, loca- tion c8h) is used to enable/disable the individual interrupt sources and to select the operating mode of the external interrupt inputs. this register can be addressed in the data space as ram location at the c8h address, nevertheless it is write-only reg- ister that can not be accessed with single-bit op- erations. the operating modes of the external interrupt inputs associated to interrupt vectors #1 and #2 are selected through bits 5 and 6 of the ior register. interrupt source associated vector vector address irin/nmi pin (1) interrupt vector # 0 (nmi) 0ffch-0ffdh none (2) interrupt vector # 1 0ff6h-0ff7h vsync interrupt vector # 2 0ff4h-0ff5h timer 1 interrupt vector # 3 0ff2h-0ff3h timer 2 interrupt vector # 4 0ff0h-0ff1h notes : 1. this pin is associated with the nmi interrupt vector 2. this vector is not used in st631xx. table 6. interrupt vectors/sources relationships interrupt (continued) ior interr upt option register (c8h, write only) d7 d6 d5 d4 d3 d2 d1 d0 unuse d gen = global enab le bit es2 = edge selection bit el1 = edge level selection bit unuse d figure 18. interrupt option register d7. not used. el1. this is the edge/level selection bit of inter- rupt #1. when set to one, the interrupt is generated on low level of the related signal; when cleared to zero, the interrupt is generated on falling edge. the bit is cleared to zero after reset and as no interrupt source is associated to vector #1 on st631xx, the user must keep this bit at zero to avoid ghost inter- rupts from this source. es2. this is the edge selection bit on interrupt #2. this bit is used on the st631xx devices with on- chip osd generator for vsync detection. gen. this is the global enable bit. when set to one all interrupts are globally enabled; when this bit is cleared to zero all interrupts are disabled (exclud- ing nmi). d3 - d0. these bits are not used. ? st63140,142,126,156 17/82
interrupt procedure. the interrupt procedure is very similar to a call procedure, indeed the user can consider the interrupt as an asynchronous call procedure. as this is an asynchronous event the user does not know about the context and the time at which it occurred. as a result the user should save all the data space registers which will be used inside the interrupt routines. there are separate sets of processor flags for normal, interrupt and non-maskable interrupt modes which are automat- ically switched and so these do not need to be saved. the following list summarizes the interrupt proce- dure: st631xx actions - interrupt detection - the flags c and z of the main routine are ex- changed with the flags c and z of the interrupt routine (or the nmi flags) - the value of the pc is stored in the first level of the stack - the normal interrupt lines are inhibited (nmi still active) - first internal latch is cleared - the related interrupt vector is loaded in the pc. user actions - user selected registers are saved inside the in- terrupt service routine (normally on a software stack) - the source of the interrupt is found by polling (if more than one source is associated to the same vector) the interrupt flag of the source. - interrupt servicing - return from interrupt (reti) st631xx actions - automatically the st631xx core switches back to the normal flags (or the interrupt flags) and pops the previous pc value from the stack the interrupt routine begins usually by the identifi- cation of the device that has generated the inter- rupt request (by polling). the user should save the registers which are used inside the interrupt rou- tine (that holds relevant data) into a software stack. after the reti instruction execution, the core car- ries out the previous actions and the main routine can continue. st631xx interrupt details ir interrupt (#0). the irin interrupt is connected to the first interrupt #0 (nmi, 0ffch). if enabled, then an interrupt will be generated on a rising edge at the pin. interrupt (#1). on st631xx no sources are associ- ated to vector (#1). to avoid any ghost interrupt due to interrupt (#1) the user must keep the el1 bit of ior register to zero. interrupt (continued) load pc from interrupt vector ( ff c / ffd ) set inte rrupt mas k push the pc into the stac k select internal mode flag check if there is an interrupt reques t and inte rrupt mask instruction wa s the inst ruction areti is the core already in normal mode ? fe tch inst ruction ex ecute inst ruction clea r interrupt mas k select program fla gs o pop o the stack ed pc no no yes ye s ? ? no yes va000014 figure 19. interrupt processing flow-chart ? st63140,142,126,156 18/82
interrupt (continued) vsync interrupt (#2). the vsync interrupt is connected to the interrupt #2. when disabled the vsync int signal is low. bit 5 of the interrupt op- tion register c8h is used to select the negative edge (es2=0) or the positive edge (es2=1); the edge willdepend on the application. note that once an edge has been latched, then the only way to re- move the latched signal is to service the interrupt. care must be taken not to generate spurious inter- rupts. this interrupt may be used for synchronize to the vsync signal in order to change characters in the osd only when the screen is on vertical blanking (if desired). this method may also be used to blink characters. timer 1 interrupt (#3). the timer 1 interrupt is connected to the fourth interrupt #3 (0ff2h) which detects a low level (latched in the timer). timer 2 interrupt (#4). the timer 2 interrupt is connected to the fifth interrupt #4 (0ff0h) which detects a high to low level (latched in the timer). notes: global disable does not reset edge sensi- tive interrupt flags. these edge sensitive interrupts become pending again when global disabling is re- leased. moreover, edge sensitive interrupts are stored in the related flags also when interrupts are globally disabled, unless each edge sensitive inter- rupt is also individually disabled before the inter- rupting event happens. global disable is done by clearing the gen bit of interrupt option register, while any individual disable is done in the control register of the peripheral. the on-chip timer pe- ripherals have an interrupt request flag bit (tmz), this bit is set to one when the device wants to gen- erate an interrupt request and a mask bit (eti) that must be set to one to allow the transfer of the flag bit to the core. ? st63140,142,126,156 19/82
figure 20. internal reset circuit the st631xx device can be reset in two ways: by the external reset input (reset ) tied low, by power-on reset and by the digital watchdog pe- ripheral. reset input the external active low reset pin is used to reset the st631xx devices and provide an orderly soft- ware startup procedure. the activation of the re- set pin may occur in the run or wait mode. even short pulses at the reset pin will be accepted since the reset signal is latched internally and is only cleared after 2048 clocks at the oscillator pin. the clocks from the oscillator pin to the reset cir- cuitry are buffered by a schmitt trigger so that an oscillator in start-up conditions will not give spuri- ous clocks. the mcu is configured in the reset mode as long as the signal of the reset pin is low. the processing of the program is stopped and the standard input/outputports (port a, port b and port c) are in the input state (except pc2). as soon as the level on the reset pin becomes high, the in- itialization sequence is executed. watchdog reset the st631xx devices are provided with an on- chip hardware activated digital watchdog function in order to provide a graceful recovery from a soft- ware upset. if the watchdog register is not re- freshed and the end-of-count is reached, then the reset state will be latched into the mcu and an in- ternal circuit pulls down the reset pin. this also resets the watchdog which subsequently turns off the pull-down and activates the pull-up device at the reset pin. this causes the positive transition at the reset pin. the mcu will then exit the reset state after 2048 clocks on the oscillator pin. application notes an external resistor between v dd and reset pin is not required because an internal pull-up device is provided. the user may prefer to add an external pull-up resistor. an internal power-on device does not guarantee that the mcu will exit the reset state when v dd is above 4.5v and therefore the reset pin should be externally controlled. reset ? st63140,142,126,156 20/82
mcu initialization sequence when a reset occurs the stack is reset to the pro- gram counter, the pc is loaded with the address of the reset vector (located in the program rom at addresses ffeh & fffh). a jump instruction to the beginning of the program has to be written into these locations. after a reset a nmi is automat- ically activated so that the core is in non-maskable interrupt mode to prevent false or ghost interrupts during the restart phase. therefore the restart rou- tine should be terminated by a reti instruction to switch to normal mode and enable interrupts. if no pending interrupt is present at the end of the reset routine the st631xx will continue with the instruc- tion after the reti; otherwise the pending interrupt will be serviced. reset is reset still present ? yes no va000427 nmi mask set int latch cleared ( if present ) select nmi mode flags put ffeh on address bus load pc from reset locations ffe / fff fetch instruction figure 21. reset & interrupt processing flow-chart jp reset vector initialization routine jp: 2 bytes/4 cycles reti: 1bytes/2 cycles reti va 000181 reset figure 22. restart initialization program flow-chart reset (continued) ? st63140,142,126,156 21/82
the stop and wait modes have been imple- mented in the st631xx core in order to reduce the consumption of the device when the latter has no instruction to execute. these two modes are de- scribed in the following paragraphs. on st631xx as the hardware activated digital watchdog func- tion is present the stop instruction is de-activated and any attempt to execute it will cause the auto- matic execution of a wait instruction. wait mode the configuration of the mcu in the wait mode occurs as soon as the wait instruction is exe- cuted. the microcontroller can also be considered as being in a asoftware frozeno state where the core stops processing the instructions of the rou- tine, the contents of the ram locations and periph- eral registers are saved as long as the power supply voltage is higher than the ram retention voltage but where the peripherals are still working. the wait mode is used when the user wants to re- duce the consumption of the mcu when it is in idle, while not losing count of time or monitoring of ex- ternal events. the oscillator is not stopped in order to provide clock signal to the peripherals. the tim- ers counting may be enabled (writing the psi bit in tscr register) and the timer interrupt may be also enabled before entering the wait mode; this al- lows the wait mode to be left when timer interrupt occurs. if the exit from the wait mode is per- formed with a general reset (either from the acti- vation of the external pin or by watchdog reset) the mcu will enter a normal reset procedure as de- scribed in the reset chapter. if an interrupt is generated during wait mode the mcu behaviour depends on the state of the st631xx core before the initialization of the wait sequence, but also of the kind of the interrupt request that is generated. this case will be described in the following para- graphs. in any case, the st631xx core does not generate any delay after the occurrence of the in- terrupt because the oscillator clock is still available. stop mode on st631xx the hardware watchdog is present and the stop instruction has been de-activated. any attempt to execute a stop will cause the automatic execution of a wait instruction. exit from wait mode the following paragraphs describe the output pro- cedure of the st631xx core from wait mode when an interrupt occurs. it must be noted that the restart sequence depends on the original state of the mcu (normal, interrupt or non-maskable inter- rupt mode) before the start of the wait sequence, but also of the type of the interrupt request that is generated. in all cases the gen bit of ior has to be set to 1 in order to restart from wait mode. contrary to the operation of nmi in the run mode, the nmi is masked in wait mode if gen=0. normal mode. if the st631xx core was in the main routine when the wait instruction has been executed, the st631xx core outputs from the wait mode as soon as any interrupt occurs; the related interrupt routine is executed and at the end of the interrupt service routine the instruction that follows the wait instruction is executed if no other inter- rupts are pending. non-maskable interrupt mode. if the wait in- struction has been executed during the execution of the non-maskable interrupt routine, the st631xx core outputs from the wait mode as soon as any interrupt occurs: the instruction that follows the wait instruction is executed and the st631xx core is still in the non-maskable interrupt mode even if another interrupt has been generated. normal interrupt mode. if the st631xx core was in the interrupt mode before the initialization of the wait sequence, it outputs from the wait mode as soon as any interrupt occurs. nevertheless, two cases have to be considered: - if the interrupt is a normal interrupt, the inter- rupt routine in which the wait was entered will be completed with the execution of the instruc- tion that follows the wait and the st631xx core is still in the interrupt mode. at the end of this routine pending interrupts will be serviced in accordance to their priority. - if the interrupt is a non-maskable interrupt, the non-maskable routine is processed at first. then, the routine in which the wait was en- tered will be completed with the execution of the instruction that follows the wait and the st631xx core is still in the normal interrupt mode. notes : if all the interrupt sources are disabled, the restart of the mcu can only be done by a reset activation. the wait instruction is not executed if an enabled interrupt request is pending. in the st631xx the hardware activated digital watchdog function is present. as the watchdog is always activated the stop instruction is de-activated and any attempt to execute the stop instruction will cause an exe- cution of a wait instruction. wait & stop modes ? st63140,142,126,156 22/82
instruction type cycles execution time branch if set/reset 5 cycles 8.125 m s branch & subroutine branch 4 cycles 6.50 m s bit manipulation 4 cycles 6.50 m s load instruction 4 cycles 6.50 m s arithmetic & logic 4 cycles 6.50 m s conditional branch 2 cycles 3.25 m s program control 2 cycles 3.25 m s table 7. intructions timing with 8mhz clock figure 23. clock generator option (1) figure 24. clock generator option (2) figure 25. oscin, oscout diagram the internal oscillator circuit is designed to require a minimum of external components. a crystal quartz, a ceramic resonator, or an external signal (provided to the oscin pin) may be used to gener- ate a system clock with various stability/cost trade- offs. the typical clock frequency is 8mhz. please note that different frequencies will affect the opera- tion of those peripherals (d/as, spi, 62.5 khz out) whose reference frequencies are derived from the system clock. the different clock generator options connection methods are shown in figures 24 and 25. one ma- chine cycle takes 13 oscillator pulses; 12 clock pulses are needed to increment the pc while and additional 13th pulse is needed to stabilize the in- ternal latches during memory addressing. this means that with a clock frequency of 8mhz the ma- chine cycle is 1.625 m sec. the crystal oscillator start-up time is a function of many variables: crystal parameters (especially rs), oscillator load capacitance (cl), ic parame- ters, ambient temperature, and supply voltage.it must be observed that the crystal or ceramic leads and circuit connections must be as short as possi- ble. typical values for cl1 and cl2 are in the range of 15pf to 22pf but these should be chosen based on the crystal manufacturers specification. typical input capacitance for oscin and oscout pins is 5pf. the oscillator output frequency is internallydivided by 13 to produce the machine cycle and by 12 to produce the timer and the watchdog clock. a byte cycle is the smallest unit needed to execute any operation (i.e., increment the program counter). an instruction may need two, four, or five byte cycles to be executed (see table 7). on-chip clock oscillator ? st63140,142,126,156 23/82
input/output ports the st631xx microcontrollers use three standard i/o ports (a,b,c) with up to eight pins on each port; refer to the device pin configurations to see which pins are available. each line can be individually programmed either in the input mode or the output mode as follows by software. - output - input with on-chip pull-up resistor (selected by software) - input without on-chip pull-up resistor (selected by software) note: pins with 12v open-drain capability do not have pull-up resistors. in output mode the following hardware configura- tions are available: - open-drain output 12v (pa0-pa7) - open-drain output 5v (pb5-pb7, pc3, pc5- pc7) - push-pull output (pb0-pb4, pc0-pc2, pc4) the lines are organized in three ports (port a,b,c). the ports occupy 6 registers in the data space. each bit of these registers is associated with a par- ticular line (for instance, the bits 0 of the port a data and direction registers are associated with the pa0 line of port a). there are three data registers (dra, drb, drc), that are used to read the voltage level values of the lines programmed in the input mode, or to write the logic value of the signal to be output on the lines configured in the output mode. the port data reg- isters can be read to get the effective logic levels of the pins, but they can be also written by the user software, in conjunction with the related data di- rection register, to select the different input mode options. single-bit operations on i/o registers (bit set/reset instructions) are possible but care is nec- essary because reading in input mode is made from i/o pins and therefore might be influenced by the external load, while writing will directly affect the port data register causing an undesired changes of the input configuration. the three data direction registers (ddra, ddrb, ddrc) allow the selection of the direction of each pin (input or output). all the i/o registers can be read or written as any other ram location of the data space. during the initialization of the mcu, all the i/o registers are cleared and the input mode with pull-up is selected on all the pins thus avoiding pin conflicts (with the exception of pc2 which is set in output mode and is set low). details of i/o ports when programmed as an input a pull-up resistor (if available) can be switched active under program control. when programmed as an output the i/o port will operate either in the push-pull mode or the open-drain mode according to the hardware fixed configuration as specified below. port a. pa0-pa7 are available as an open-drain only (no push-pull programmability and no resis- tive pull-up in input mode) capable of withstanding 12v while the normal open drain has standard rat- ings of v dd + 0.3v. this i/o port has been specially designed for direct led driving and is able to sink up to 30ma with a maximum v ol of 1v. some port b and c lines are also used as i/o buff- ers for signals coming from the on-chip spi and osd. in this case the final signal on the output pin is equivalent to a wired and with the programmed data output. if the user needs to use the spi or the osd, then the i/o line should be set in output mode while the open-drain configuration is fixed in hardware ; the corresponding data bit must be set to one. pb2 and pb3 must be programmed in input mode to provide the hsync and vsync input signals to the osd. on st631xx the i/o pins with double or special functions are: - pb2/vsync (connected to the osd vsync signal) - pb3/hsync (connected to the osd hsync signal) - pb5/scl (connected to the spi clock signal) - pb6/sda (connected to the spi data signal) - pb7/sen (connected to the spi enable signal) - pc2-on-off, this i/o is specially suited to tv set on-off and for this reason at reset the related data direction bit will be automatically set to one (i/o line is in output mode), while the rest of the port is in input mode - pc3/blank (connected to the osd blank sig- nal) - pc5/r, pc6/g, pc7/b (connected to the osd r-g-b signals) all the port a,b and c i/o lines have schmitt-trig- ger input configuration with a typical hysteresis of 1v. ? st63140,142,126,156 24/82
ddr dr mode option 0 0 input with on-chip pull-up resistor 0 1 input without on-chip pull-up resistor 1 x output open-drain or push-pull note : x: means don't care. table 8. i/o port options selection dra, drb, drc port a, b, c data register ( c0h pa, c1h pb, c2h pc read/ write ) d7 d6 d5 d4 d3 d2 d1 d0 pa0 - pa7 = data bits pb0 - pb7 = data bits pc0 - pc7 = data bits figure 24. port a, b, c data register ddrpa, ddrpb,ddrpc port a, b, c data direction register ( c4h pa, c5h pb, c6h pc read/ write ) d7 d6 d5 d4 d3 d2 d1 d0 pa0 - pa7 = data direction bits pb0 - pb7 = data direction bits pc0 - pc7 = data direction bits a0o defines bit as inpu t o1o defines bit as outpu t figure 25. port a, b, c data direction register input/output ports (continued) pa7-pa0. these are the i/o port a data direction bits. when a bit is cleared to zero the related i/o line is in input mode, if bit is set to one the related i/o line is in output mode. reset at power-on. pb7-pb0. these are the i/o port b data direction bits. when a bit is cleared to zero the related i/o line is in input mode, if bit is set to one the related i/o line is in output mode. reset at power-on. pc7-pc0. these are the i/o port c data direction bits. when a bit is cleared to zero the related i/o line is in input mode, if bit is set to one the related i/o line is in output mode. set to 04h at power-on. bit 2 (pc2 pin) is set to one (output mode selected) as this line is intended for tv on-off switching. i/o pin programming each pin can be individually programmed as input or output with different input and output configurations. this is achieved by writing to the relevant bit in the data (dr) and data direction register (ddr). table 8 shows all the port configurations that can be se- lected by the user software. pa7-pa0. these are the i/o port a data bits. reset at power-on. pb7-pb0. these are the i/o port b data bits. reset at power-on. pc7-pc0. these are the i/o port c data bits. reset at power-on. ? st63140,142,126,156 25/82
figure 26. i/o configuration diagram (open drain 12v) figure 27. i/o configuration diagram (open drain 5v, push-pull) input/output configurations the following schematics show the i/o lines hard- ware configuration for the different options. figure 30 shows the i/o configuration for an i/o pin with open-drain 12v capability (standard drive and high drive). figure 31 shows the i/o configuration for an i/o pin with push-pull and with open drain 5v capa- bility. notes : the wait instruction allows the st631xx to be used in situations where low power consumption is needed. this can only be achieved however if the i/o pins either are programmed as inputs with well defined logic levels or have no power consuming resistive loads in output mode. as the same die is used for the different st631xx versions the un- available i/o lines of st631xx should be pro- grammed in output mode. single-bit operations on i/o registers are possible but care is necessary because reading in input mode is made from i/o pins while writing will di- rectly affect the port data register causing an unde- sired changes of the input configuration. input/output ports (continued) ? st63140,142,126,156 26/82
the st631xx devices offer two on-chip timer pe- ripherals consisting of an 8-bit counter with a 7-bit programmable prescaler, thus giving a maximum count of 2 15 , and a control logic that allows config- uring the peripheral operating mode. figure 30 shows the timer block diagram. the content of the 8-bit counters can be read/written in the timer/counter registers tcr that can be ad- dressed in the data space as ram location at ad- dresses d3h (timer 1) and dbh (timer 2). the state of the 7-bit prescaler can be read in the psc register at addresses d2h (timer 1) and dah (timer 2). the control logic is managed by tscr registers at d4h (timer 1) and dch (timer 2) ad- dresses as described in the following paragraphs. the following description applies to both timer 1 and timer 2. the 8-bit counter is decrement by the output (rising edge) coming from the 7-bit pres- caler and can be loaded and read under program control. when it decrements to zero then the tmz (timer zero) bit in the tscr is set to one. if the eti (enable timer interrupt) bit in the tscr is also set to one an interrupt request, associated to interrupt vector #3 (for timer 1) and #1 for timer 2, is gener- ated. the interrupt of the timer can be used to exit the mcu from the wait mode. figure 28. timer peripheral block diagram timers the prescaler decrements on rising edge. the prescaler input is the oscillator frequency divided by 12 or an external clock at timer pin (this is not available in st631xx). depending on the division factor programmed by ps2/ps1/ps0 (see table 9) bits in the tscr, the clock input of the timer/counter register is multi- plexed to different sources. on division factor 1, the clock input of the prescaler is also that of timer/counter; on factor 2, bit 0 of prescaler register is connectedto the clock input of tcr. this bit changes its state with the half frequency of prescaler clock input. on factor 4, bit 1 of psc is connected to clock input of tcr, and so on. on di- vision factor 128, the msb bit 6 of psc is con- nected to clock input of tcr. the prescaler initialize bit (psi) in the tscr register must be set to one to allow the prescaler (and hence the counter) to start. if it is cleared to zero then all of the prescaler bits are set to one and the counter is inhibited from counting. the prescaler can be given any value between 0 and 7fh by writing to the related register address, if bit psi in the tscr register is set to one. the tap of the prescaler is selected using the ps2/ps1/ps0bits in the control register. figure 33 shows the timer working principle. ? st63140,142,126,156 27/82
timers (continued) timer operating modes as the external timer pin is not available on st631xx devices, the only allowed operating mode is the output mode that have to be selected by set- ting to 1 bit 4 and by clearing to 0 bit 5 in the tscr1 register. this procedure will enable both timer 1 and timer 2. output mode (tscr1 d4 = 1, tscr1 d5 = 0). on this mode the timer prescaler is clocked by the prescaler clock input (osc/12). the user can se- lect the desired prescaler division ratio through the ps2/ps1/ps0 bits. when tcr count reaches 0, it sets the tmz bit in the tscr. the tmz bit can be tested under program control to perform timer functions whenever it goes high. bit d4 and d5 on tscr2 (timer 2) register are not implemented. timer interrupt when the counter register decrements to zero and the software controlled eti (enable timer interrupt) bit is set to one then an interrupt request associ- ated to interrupt vector #3 (for timer 1) and to inter- rupt vector #4 (for timer 2) is generated. when the counter decrements to zero also the tmz bit in the tscr register is set to one. figure 29. timer working principle notes : tmz is set when the counter reaches 00h ; how- ever, it may be set by writing 00h in the tcr regis- ter or setting the bit 7 of the tscr register. tmz bit must be cleared by user software when servic- ing the timer interrupt to avoid undesired interrupts when leaving the interrupt service routine. after re- set, the 8-bit counter register is loaded to ffh while the 7-bit prescaler is loaded to 7fh , and the tscr register is cleared which means that timer is stopped (psi=0) and timer interrupt disabled. a write to the tcr register will predominate over the 8-bit counter decrement to 00h function, i.e. if a write and a tcr register decrement to 00h occur simultaneously, the write will take precedence, and the tmz bit is not set until the 8-bit counter reaches 00h again. the values of the tcr and the psc registers can be read accurately at any time. ? st63140,142,126,156 28/82
ps2 ps1 ps0 divided by 000 1 001 2 010 4 011 8 10016 10132 11064 1 1 1 128 table 9. prescaler division factors tscr timer 1&2 status control register s d4h timer 1, dch timer 2, read/ write d7 d6 d5 d4 d3 d2 d1 d0 ps0 = prescaler mux. select ps1 = prescaler mux. select ps2 = prescaler mux. select psi = prescaler initialize bit d4 = timers enable bit * d5 = timers enable bit * eti = enable timer inte rrupt tmz = timer zero bit * only available in tscr1 figure 30. timer status control registers timers (continued) tcr timer counter 1&2 register d3h timer 1, dbh timer 2, read/ write d7 d6 d5 d4 d3 d2 d1 d0 d7 - d0 = counter bits figure 31. timer counter registers psc timerprescaler 1&2 register d2h timer 1, dah timer 2, read/ write d7 d6 d5 d4 d3 d2 d1 d0 d6 - d0 = prescaler bits always read as a0o figure 32. timer counter registers tmz. low-to-high transition indicates that the timer count register has decrement to zero. this bit must be cleared by user software before to start with a new count. eti. this bit, when set, enables the timer interrupt (vector #3 for timer 1, vector #4 for timer 2) request. if eti=0 the timer interrupt is disabled. if eti= 1 and tmz= 1 an interrupt request is generated. d5. this is the timers enable bit d5. it must be cleared to 0 together with a set to 1 of bit d4 to en- able both timer 1 and timer 2 functions. it is not implemented on tscr2 register. d4. this is the timers enable bit d4. this bit must be set to 1 together with a clear to 0 of bit d5 to en- able both timer 1 and timer 2 functions. it is not implemented on tscr2 register. d5 d4 timers 0 0 disabled 0 1 enabled 1 x reserved psi. used to initialize the prescaler and inhibit its countingwhile psi = 0 the prescaler is set to 7fh and the counter is inhibited. when psi = 1 the prescaler is enabled to count downwards. as long as psi= 0 both counter and prescaler are not running. ps2-ps0. these bits select the division ratio of the prescaler register (see table 9) the tscr1 and tscr2 registers are cleared on reset. the correct d4-d5 combination must be written in tscr1 by user's software to enable the operation of timer 1 and timer 2. ? st63140,142,126,156 29/82
figure 33. hardware activated watchdog block diagram figure 34. hardware activated watchdog working principle the hardware activated digital watchdog function consists of a down counter that is automatically ini- tialized after reset so that this function does not need to be activated by the user program. as the watchdog function is always activated this down counter can not be used as a timer. the watchdog is using one data space register (hwdr location d8h). the watchdog register is set to feh on reset and immediately starts to count down, requiring no software start. similarly the hardware activated watchdog can not be stopped or delayed by soft- ware. the watchdog time can be programmed using the 6 msbits in the watchdog register, this gives the possi- bility to generate a reset in a time between 3072 to 196608 oscillator cycles in 64 possible steps (with a clock frequency of 8mhz this means from 384 m sto 24.576ms). the reset is prevented if the register is reloaded with the desired value before bits 2-7 decrement from all zeros to all ones. the presence of the hardware watchdog deactivates the stop instruction and a wait instruction is auto- matically executed instead of a stop. bit 1 of the watchdog register (set to one at reset) can be used to generate a software reset if cleared to zero). hardware activated digital watchdog function ? st63140,142,126,156 30/82
hwdr hardware activated watchdog register (d8h, read/ write) d7 d6 d5 d4 d3 d2 d1 d0 c = watchdog activation bit sr = software reset bit t1-t6 = counter bits figure 35. watchdog register hardware activated digital watchdog function (continued) t1-t6. these are the watchdog counter bits. it should be noted that d7 (t1) is the lsb of the counter and d2 (t6) is the msb of the counter, these bits are in the opposite order to normal. sr. this bit is set to one during the reset phase and will generate a software reset if cleared to zero. c. this is the watchdog activation bit that is hard- ware set to one; the user can not change the value of this bit. the watchdog function is always acti- vated independently of changes of value of this bit. the register reset value is feh (bit 1-7 set to one, bit 0 cleared). ssdr spi serial data register (cch, read/ write) d7 d6 d5 d4 d3 d2 d1 d0 d0-d7 = data bits figure 36. spi serial data register serial peripheral interface the st631xx serial peripheral interface (spi) has been designed to be cost effective and flexible in interfacing the various peripherals in tv applica- tions. it maintains the software flexibility but adds hard- ware configurations suitable to drive devices which require a fast exchange of data. the three pins dedicated for serial data transfer (single master only) can operate in the following ways: - as standard i/o lines (software configuration) - as s-bus or as i 2 cbus (two pins) - as standard (shift register) spi when using the hardware spi, a fixed clock rate of 62.5khz is provided. it has to be noted that the first bit that is output on the data line by the 8-bit shift register is the msb. spi data/control registers for i/o details on scl (serial clock), sda (serial data) and sen (serial enable) please refer to i/o ports description with reference to the following registers: port b data register, address c1h (read/write). - bit d5 asclo - bit d6 asdao - bit d7 aseno port b data direction register, address c5h (read/write). d7-d0. these are the spi data bits. they can be neither read nor written when spi is operating (busy bit set). they are undefined after reset. ? st63140,142,126,156 31/82
scr1 spi control register 1 (ebh, write only) d7 d6 d5 d4 d3 d2 d1 d0 s-bus/i 2 c bus selection std/spi enable stp = stop bit 2 str = start bit 3 unused figure 37. spi control register 1 serial peripheral interface (continued) d1 std/sp d0 s-bus/i 2 c bus spi function 0 0 disabled 0 1 std shift reg. 10i 2 c bus 1 1 s-bus table 10. spi modes selection scr2 spi control register 2 (ech, read/ write) d7 d6 d5 d4 d3 d2 d1 d0 bsy = busy bit 0 acn = acknowledge bit vry/s = verify/sync.enab le tx/rx = enable bit unuse d figure 38. spi control register 2 d7-d4. these bits are not used. str. this is start bit for i 2 cbus/s-bus. this bit is meaningless when std/spi enable bit is cleared to zero. if this bit is set to one std/spi bit is also set to a1o and spi start generation, before beginning of transmission, is enabled. set to zero after reset. stp. this is stop bit for i 2 cbus/s-bus. this bit is meaningless when std/spi enable bit is cleared to zero. if this bit is set to one std/spi bit is also set to a1o and spi stop condition generation is en- abled. stp bit must be reset when standard proto- col is used (this is also the default reset conditions). set to zero after reset. std, spi enable. this bit, in conjunction with s- bus/i 2 cbus bit, allows the spi disable and will select between i 2 cbus/s-bus and standard shift register protocols. if this bit is set to one, it selects both i 2 cbus and s-bus protocols; final selection between them is made by s-bus/i 2 cbus bit. if this bit is cleared to zero when s-bus/i 2 cbus is set to a1o the standard shift register protocol is selected. if this bit is cleared to a0o when s- bus/i 2 cbus is cleared to 0 the spi is disabled. set to zero after reset. s-bus/i 2 cbus selection. this bit, in conjunction with std/spi bit, allows the spi disable and will select between i 2 cbus and s-bus protocols. if this bit is cleared to a0o when std bit is also a0o, the spi interface is disabled. if this bit is cleared to zero when std bit is set to a1o, the i 2 cbus protocol will be selected. if this bit is set to a1o when std bit is set to a1o, the s-bus protocol will be selected. cleared to zero after reset. d7-d4. these bits are not used. tx/rx. write only. when this bit is set, current byte operation is a transmission. when it is reset, cur- rent operation is a reception. set to zero after re- set. vry/s. read only/write only. this bit has two dif- ferent functions in relation to read or write opera- tion. reading operation: when std and/or trx bits is cleared to 0, this bit is meaningless. when bits std and tx are set to 1, this bit is set each time bsy bit is set. this bit is reset during byte op- eration if real data on sda line are different from the output from the shift register. set to zero after reset. writing operation : it enables (if set to one) or disables (if cleared to zero) the interrupt coming from vsync pin. undefined after reset. refer to osd description for additional information. acn. read only. if std bit (d1 of scr1 register) is cleared to zero this bit is meaningless. when std is set to one, this bit is set to one if no acknowledge has been received. in this case it is automatically reset when bsy is set again. set to zero after re- set. bsy. read/set only. this is the busy bit. when a one is loaded into this bit the spi interface start the transmission of the data byte loaded into ssdr data register or receiving and building the receive data into the ssdr data register. this is done in accordance with the protocol, direction and start/stop condition(s). this bit is automatically cleared at the end of the current byte operation. cleared to zero after reset. note : the spi shift register is also the data transmission register and the data received register; this feature is made possible by using the serial structure of the st631xx and thus reducing size and complexity. ? st63140,142,126,156 32/82
during transmission or reception of data, all ac- cess to serial data register is therefore disabled. the reception or transmission of data is started by setting the busy bit to a1o; this will be automat- ically reset at the end of the operation. after reset, the busy bit is cleared to a0o, and the hardware spi disabled by clearing bit 0 and bit 1 of spi control register 1 to a0o. the outputs from the hardware spi are aandedo to the standard i/o software con- trolled outputs. if the hardware spi is in operation the port c pins related to the spi should be config- ured as outputs using the data direction register and should be set high. when the spi is configured as the s-bus, the three pins pc0, pc1 and pc3 become the pins scl, sda and sen respectively. when configured as the i 2 cbus the pins pc0 and pc1 are configured as the pins scl and sda; pc3 is not driven and can be used as a general purpose i/o pin. in the case of the std spi the pins pc0 and pc1 become the signals clock and data, pc3 is not driven and can be used as general pur- pose i/o pin. the verify bit is available when the spi is configured as either s-bus or i 2 cbus. at the start of a byte transmission, the verify bit is set to one. if at any time during the transmission of the following eight bits, the data on the sda line does not match the data forced by the spi (while scl is high), then the verify bit is reset. the verify is available only during transmission for the s-bus and i 2 cbus; for other protocol it is not defined. the sda and scl signal entering the spi are buff- ered in order to remove any minor glitches. when std bit is set to one (s-bus or i 2 cbus selected), and trx bit is reset (receiving data), and stop bit is set (last byte of current communication), the spi interface does not generate the acknowledge, ac- cording to s-bus/i 2 cbus specifications. pco- scl, pc1-sda and pc3-sen lines are standard drive i/o port pins with open-drain output configura- tion (maximum voltage that can be applied to these pins is v dd +0.3v). s-bus/i 2 cbus protocol information the s-bus is a three-wire bidirectional data-bus with functional features similar to the i 2 cbus. in fact the s-bus includes decoding of start/stop conditions and the arbitration procedure in case of multimaster system configuration (the st631xx spi allows a single-master only operation). the sda line, in the i 2 cbus represents the and com- bination of sda and sen lines in the s-bus. if the sda and the sen lines are short-circuit con- nected, they appear as the sda line of the i 2 cbus. the start/stop conditions are detected (by the external peripherals suited to work with s- bus/i 2 cbus) in the following way: - on s-bus by a transition of the sen line (1 to 0 start, 0 to 1 stop) while the scl line is at high level. - on i 2 cbus by a transition of the sda line (10 start, 01stop) while the scl line is at high level. start and stop condition are always generated by the master (st631xx spi can only work as single master). the bus is busy after the start condition and can be considered again free only when a certain time delay is left after the stop condition. in the s- bus configuration the sda line is only allowed to change during the time scl line is low. after the start information the sen line returns to high level and re- mains unchangedfor all the data transmission time. when the transmission is completed the sda line is set to high level and, at the same time, the sen line returns to the low level in order to supply the stop in- formation with a low to high transition, while the scl line is at high level. on the s-bus, as on the i 2 cbus, each eight bit information (byte) is followed by one acknowledged bit which is a high level put on the sda line by the transmitter. a peripheral that ac- knowledges has to pull down the sda line during the acknowledge clock pulse. an addressed receiver has to generate an acknowledge after the reception of each byte; otherwise the sda line remains at the high level during the ninth clock pulse time. in this case the master transmitter can generate the stop condition, via the sen (or sda in i 2 cbus) line, in order to abort the transfer. serial peripheral interface (continued) ? st63140,142,126,156 33/82
start/stop acknowledge. the timing specs of the s-bus protocol require that data on the sda (only on this line for i 2 cbus) and sen lines be stable during the ahigho time of scl. two exceptions to this rule are foreseen and they are used to signal the start and stop condition of data transfer. - on s-bus by a transition of the sen line (10 start, 01 stop) while the scl line is at high level. - on i 2 cbus by a transition of the sda line (10 start, 01 stop) while the scl line is at high level. data are transmitted in 8-bit groups; after each group, a ninth bit is interposed, with the purpose of acknowledging the transmitting sequence (the transmit device place a a1o on the bus, the acknow- ledging receiver a a0o). interface protocol. this paragraph deals with the description of data protocol structure. the inter- face protocol includes: - a start condition - a aslave chip addresso byte, transmitted by the master, containing two different information: a. the code identifying the device the master wants to address (this information is present in the first seven bits) b. the direction of transmission on the bus (this information is given in the 8th bit of the byte); a0o means awriteo, that is from the master to the slave, while a1o means areado. the ad- dressed slave must always acknowledge. the sequence from, now on, is different according to the value of r/w bit. 1. r/w = a0o (write) in all the following bytes the master acts as trans- mitter; the sequence follows with: a. an optional data byte to address (if needed) the slave location to be written (it can be a word ad- dress in a memory or a register address, etc.). b. a adatao byte which will be written at the ad- dress given in the previous byte. c. further data bytes. d. a stop condition a data transfer is always terminated by a stop con- dition generated from the master. the st631xx peripheral must finish with a stop condition before another start is given. figure 44 shows an example of write operation. 2. r/w = a1o (read) in this case the slave acts as transmitter and, therefore, the transmission direction is changed. in read mode two different conditions can be consid- ered: a. the master reads slave immediately after first byte. in this case after the slave address sent from the master with read condition enabled the master transmitter becomes master re- ceiver and the slave receiver becomes slave transmitter. b. the master reads a specified register or loca- tion of the slave. in this case the first sent byte will contain the slave address with write condi- tion enabled, then the second byte will specify the address of the register to be read. at this moment a new start is given together with the slave address in read mode and the procedure will proceed as described in previous point aao. serial peripheral interface (continued) ? st63140,142,126,156 34/82
acknowledge from slave acknowledge from slave acknowledge from slave start r/w stop start r/w stop start stop figure 39.master transmit to slave receiver (write mode) s slave address 0 a word address a data a p acknowledge from slave acknowledge from master no acknowledge from master r/w n bytes figure 40.master reads slave immediately after first byte (read mode) s slave address 1 a data a data 1 p msb msb msb figure 41.master reads after setting slave register address (write address, read data) s slave address 0 a x word address a p acknowledge from slave acknowledge from slave r/w stop start s slave address 1 a data a data 1 p msb msb acknowledge from slave acknowledge from master no acknowledge from master serial peripheral interface (continued) ? st63140,142,126,156 35/82
figure 42. s-bus timing diagram serial peripheral interface (continued) s-bus/i 2 cbus timing diagrams the clock of the s-bus/i 2 cbus of the st631xx spi (single master only) has a fixed bus clock fre- quency of 62.5khz. all the devices connected to the bus must be able to follow transfers with frequencies up to 62.5khz, either by being able to transmit or receive at that speed or by applying the clock synchronization procedure which will force the master into a wait state and stretch low peri- ods. ? st63140,142,126,156 36/82
figure 43. i 2 c bus timing diagram note: the third pin, sen, should be high; it is not used in the i 2 cbus. logically sda is the and of the s-bus sda and sen. serial peripheral interface (continued) ? st63140,142,126,156 37/82
compatibility s-bus/i 2 cbus using the s-bus protocol it is possible to imple- ment mixed system including s-bus/i 2 cbus bus peripherals. in order to have the compatibility with the i 2 cbus peripherals, the devices including the s-bus interface must have their sda and sen pins connected together as shown in the following (a) (b) (c) figure 44.s-bus/i 2 c bus mixed configurations serial peripheral interface (continued) figure 44 (a and b). it is also possible to use mixed s-bus/i 2 cbus protocols as showed in figure 48 (c). s-bus peripherals will only react to s-bus protocol signals, while i 2 cbus peripherals will only react to i 2 cbus signals. multimaster configu- ration is not possible with the st631xx spi (single master only). ? st63140,142,126,156 38/82
figure 45.std bus (hardware bus disabled) timing diagram std spi protocol (shift register) this protocol is similar to the i 2 cbus with the ex- ception that there is no acknowledge pulse and there are no stop or start bits. the clock cannot be slowed down by the externalperipherals. the i/o ports associated with the spi should be programmed as outputs with data high in order not to inhibit the functionality of the hardware spi. spi application notes stop clock slowdown: in the st631xx family of devices when operating in the i 2 c or sbus modes, there is no internal clock slowdown for the final stop clock. slowdown means that if an external peripheral requires extra time it will hold the st631xx scl clock low. to be fully i 2 c and sbus compatible in this respect, the sw should check serial peripheral interface (continued) that the scl line is indeed high beforeproceeding with the start of another i 2 c or sbus transmis- sion. in all other cases the scl clock slowdown feature is operational. spi standard bus protocol: the standard bus protocol is selected by loading the spi control register 1 (scr1 add. ebh). bit 0 named i 2 c must be set at one and bit 1 named std mut be reset. when the standard bus protocol is selected bit 2 of the scr1 is meaningless. this bit named stop bit is used only in i 2 cbus or sbus. however take care thet the stop bit must be reset when the standard pro- tocol is used. this bit is set to zero after re- set. ? st63140,142,126,156 39/82
the st631xx on-chip voltage synthesis tuning pe- ripheral has been integrated to allow the genera- tion of tuning reference voltage in low/mid end tv set applications. the peripheral is composed of a 14-bit counter that allows the conversion of the digital content in a tuning voltage, available at the vs output pin, by using pulse width modification (pwm), and bit rate multiplier (brm) techniques. the 14-bit counter gives 16384 steps which allows a resolution of approximately 2mv over a tuning voltage of 32v; this corresponds to a tuning resolu- tion of about 40khz per step in the uhf band (the actual value will depend on the characteristics of the tuner). the tuning word consists of a 14-bit word con- tained in the registers vsdata1 (location 0edh) and vsdata2 (location 0eeh). coarse tuning (pwm) is performed using the seven msbits, while fine tuning (brm) is performed using the data in the seven lsbits. with all zeros loaded the output is zero; as the tuning voltage increases from all ze- ros, the number of pulses in one period increas to 128 with all pulses being the same width. for val- ues larger than 128, the pwm takes over and the number of pulses in one period remains constant at 128, but the width changes. at the other end of the scale, when almost all ones are loaded, the pulses will start to link together and the number of pulses will decrease. when all ones are loaded, the output will be almost 100% high but will have a low pulse (1/16384 of the high pulse). output details inside the on-chip voltage synthesis are included the register latches, a reference counter, pwm and brm control circuitry. in the st631xx the clock for the 14-bit reference counter is 2mhz derived from the 8mhz system clock. from the circuit point of view, the seven most significant bits control the coarse tuning, while the seven least significant bits control the fine tuning. from the application and software point of view, the 14 bits can be consid- ered as one binary number. as already mentioned the coarse tuning consists of a pwm signal with 128 steps; we can consider the fine tuning to cover 128 coarse tuning cycles. the addition of pulses is described in the following table. fine tuning (7 lsb) n of pulses added at the following cycles (0...127) 0000001 64 0000010 32, 96 0000100 16, 48, 80, 112 0001000 8, 24, ....104, 120 0010000 4, 12, ....116, 124 0100000 2, 6, .....122, 126 1000000 1, 3, .....125, 127 table 11. fine tuning pulse addition vsdr1 voltage synthesis data register 1 (edh, write only) d7 d6 d5 d4 d3 d2 d1 d0 vs data bits (lsb) figure 46. voltage synthesis data register 1 14-bit voltage synthesis tuning peripheral the vs output pin has a standard drive push-pull output configuration. vs tuning cell registers d7-d0. these are the 8 least significant vs data bits. bit 0 is the lsb. this register is undefined on reset. vsdr2 voltage synthesis data register 2 (eeh, write only) d7 d6 d5 d4 d3 d2 d1 d0 vs data bits (lsb) unuse d figure 47. voltage synthesis data register 2 d7-d6. these bits are not used. d5-d0. these are the 6 most significant vs data bits. bit 5 is the msb. this register is undefined on reset. ? st63140,142,126,156 40/82
the d/a macrocell contains four pwm d/a outputs (31.25khz repetition, da0-da3) with six bit resolu- tion plus a 62.5khz open-drain output pin (out1) specially suited for multistandard chroma proces- sors driving. both the d/a and out1 functions can be disabled by software allowing the da0-da3 and out1 pins to be used as general purpose open- drain output pins able to withstand signals with up to 12v amplitude. 6-bit d/a converters each d/a converter of st631xx is composed by the following main blocks: - pre-divider - 6-bit counter - data latches and compare circuits the pre-divider uses the clock input frequency (8mhz) and its output clocks the 6-bit free-running counter. the data latched in the four registers (e0h, e1h, e2h and e3h) control the four d/a out- puts (da0,1,2 and 3). when all zeros are loaded the relevant output is an high logic level; all 1's cor- respond to a pulse with a 1/64 duty cycle and al- most 100% zero level. a 7th bit (bit d6) is used to enable the relevant d/a output; when zero, the d/a is no longer enabled and it forces the output to zero. if the other six bits are all zero then the output is controlled only by the enable bit. the repetition frequency is 32.5khz and is related to the 8mhz clock frequency. all d/a outputs are open-drain with standard current drive capability and able to withstand up to 12v. 62.5 khz output this pin provides a 62.5 khz signal with a 50% duty cycle; the output is enabled by a dedicated enable bit (e0h register bit 7). when the 62.5khz fre- quency is disabled then the output is controlled by the out1 bit and the line can be used as general purpose open-drain output (e1h bit 7). the out1 output is open-drain with standard current drive ca- pability and able to withstand signals with up to 12v amplitude. d/a and out1 data/control registers this paragraph deals with the description of d/a and out1 data/control registers. some bits of da2 and da3 data/control registers are used for exter- nal interrupt enable and a/d reference voltage shift, please refer to a/d and ir descriptions for ad- ditional information. figure 48. 6-bit pwm d/a & 62.5khz output configuration da0-da5. these are the 6 bits of the pwm digital to analog converter . undefined after reset. dae. this is the d/a 0 enable bit. if zero, the output of the d/a is forced to zero; if one, the output of the d/a dependson bits da0..da5. undefined after reset. fo1. this is the 62.5khz frequency output/ out1 selection bit. if one, the out1 pin will give a 62.5khz frequency; if zero the out1 pin can be used as general purpose open-drain output and the value present on the pin depends on the value of out1 bit programmed in the da1 data/control register. undefined after reset. 6-bit pwm d/a converter and 62.5 khz output function da0 da0 data/contr ol registers (e0h, write only) d7 d6 d5 d4 d3 d2 d1 d0 data bit 0 data bit 1 data bit 2 data bit 3 data bit 4 data bit 5 dae d/a enable bit fo1 62.5 khzselection bit figure 49. da0 data/enable register ? st63140,142,126,156 41/82
6-bit pwm d/a converters and 62.5 khz output function (continued) da0-da5. these are the 6 bits of the pwm digital to analog converter. undefined after reset. dae. this is the d/a 1 enable bit. if zero, the out- put of the d/a is forced to zero; if one, the output of the d/a depends on bits da0..da5. undefined af- ter reset. out1. this is the out1 data bit. the content of this bit is output on the out1 pin when the 62.5khz frequency function is disabled (fo1 bit in da0 reg- ister is cleared to zero). undefined after reset. da0-da5. these are the 6 bits of the pwm digital to analog converter bits. undefined after reset. dae. this is the d/a 2 enable bit. if zero, the out- put of the d/a is forced to zero; if one, the output of the d/a depends on bits da0..da5. undefined af- ter reset. ien. this is the external interrupt enable. if set to one, the interrupt coming from the external inter- rupt pin is enabled, if this bit is cleared the interrupt is disabled. undefined after reset. this interrupt is associated to the nmi interrupt vector. refer to ir and interrupt descriptions for additional informa- tion. da1 da1 data/control registers (e1h, write only) d7 d6 d5 d4 d3 d2 d1 d0 data bit 0 data bit 1 data bit 2 data bit 3 data bit 4 data bit 5 dae d/a enable bit out1 data bit figure 50. da1 data/enable register da0-da5. these are the 6 bits of the pwm digital to analog converter. undefined after reset. dae. this is the d/a 3 enable bit. if zero, the out- put of the d/a is forced to zero; if one, the output of the d/a depends on bits da0..da5. undefined af- ter reset. adsh. this is the analog to digital converter refer- ence voltage shift bit. if set to one, the afc block has reference voltages on 1v border. if set to zero, on 0.5v border. undefined after reset. refer to afc for additional information. da2 da2 data/control registers (e2h write only) d7 d6 d5 d4 d3 d2 d1 d0 data bit 0 data bit 1 data bit 2 data bit 3 data bit 4 data bit 5 dae d/a enable bit ien ir interrupt enable figure 51. da2 data/enable register da3 da3 data/contr ol registers (e3h, write only) d7 d6 d5 d4 d3 d2 d1 d0 data bit 0 data bit 1 data bit 2 data bit 3 data bit 4 data bit 5 dae d/a enable bit adsh a/d referenceshift figure 52. da3 data/enable register ? st63140,142,126,156 42/82
afc a/d input, keyboard inputs and bandswith outputs the afc macrocell contains an a/d comparator with five levels at intervals of 1v from 1v to 5v. the levels can all be lowered by 0.5v to effectively dou- ble the resolution. this a/d can be used to perform the afc function. in addition this cell offers also a keyboard input register of three bits used to per- form a keyboard scan and 4 open-drain outputs (able to withstand signals up to 12v) that can be used to perform band switch function. figure 53. afc, kby inputs configuration dia- grams figure 54. bsw, da, out1 output configu- ration diagram a/d comparator the a/d used to perform the afc function (when high threshold is selected) has the following volt- age levels: 1,2,3,4 and 5v. bits 0-2 of afc result register (e4h address) will provide the result in bi- nary form (less than 1v is 000, greater than 5v is 101). if the application requires a greater resolution, the sensitivity can be doubled by clearing to zero bit 7 of da3 data/control register, address e3h (refer to d/a description for additional information). in this case all levels are shifted lower by 0.5v. if the two results are now added within a software routine then the a/d s-curve can be located within a resolu- tion of 0.5v. the a/d input has high impedance able to withstand up to 13v signals (input level toler- ances 200mv absolute and 100mv relative to 5v). afc, keyboard inputs and bandswitch out- puts data/control registers afcr afc result register (e4h, read only) d7 d6 d5 d4 d3 d2 d1 d0 ad2-ad0 a/d = conversion result unuse d figure 55. afc result register d7-d3. these bits are not used. ad0-ad2. these bits store the real time conver- sion of the value present on the afc input pin. no reset value. ? st63140,142,126,156 43/82
kbyreg keyboard input register (e5h, read only) d7 d6 d5 d4 d3 d2 d1 d0 kby0 input data bit kby1 input data bit kby2 input data bit unused figure 56. keyboard input register d7-d3. these bits are not used. kby0-kby2. these bits store the logic level pre- sent at kby0, kby1 and kby2 input pins. no reset value. this input pins have cmos levels with on- chip pull-up resistor (100k w typical). d6-d3. these bits are not used. bsw0-bsw2,bsw3. the writing into these bits will cause the corresponding bsw open-drain out- put line to switch to the programmed level. unde- fined after reset. afc a/d input, keyboard inputs and bandswith outputs (continued) bswreg bandswitch output register (e9h, write only) d7 d6 d5 d4 d3 d2 d1 d0 bsw0 output bit bsw1 output bit bsw2 output bit unused bsw3 output bit figure 57. bandswitch output register infrared input (irin) the irin pin is directly connected to the nmi inter- rupt and acts as external interrupt pin (refer to in- terrupt description for additional information). the enable/disable of this interrupt can be man- aged with the write only ien bit available in the da2 data/control register (address e2h, bit d7). when this bit is set to one the interrupt is enabled otherwise it is disabled. the irin pin is rising edge sensitive. application note when the ir interrupt is enabled, then a rising edge on the ir pin will generate an interrupt; if the ir interrupt is disabled, no ir interrupts can occur. care should be taken because if the ir pin is high when the ir interrupt is enabled, an interrupt will also be generated; the following method to elimi- nate noise can also be used if the sw engineer wishes to enable/disable the ir interrupt. if a low-cost infra-red receiver is used, the cus- stomer may wish to test the ir signal by software after an interrupt in order to verify that there is a good pulse and not just noise. the irin pin cannot be read, so in this case it should be connected in parallel with another pin so the signal can be read. furthermore the irin pin is sensitive to a rising edge interrupt; this means that the input to the pin should be low in the presence of no infra-red sig- nal, but since most infra-red receiver modules give a high signal, the signal will need to be inverted with a transistor. ? st63140,142,126,156 44/82
the st631xx osd macrocell is a cmos lsi char- acter generator which enable display of characters and symbols on the tv screen. the character rounding function enhances the readability of the characters. the st631xx osd receives horizontal and vertical synchronization signal and outputs screen information via r, g, b and blanking pins. the main characteristics of the macrocell are listed below: - number of display characters: 5 lines by 15 columns. - number of character types: 128 characters in two banks of 64 characters. only one bank per screen can be used. - character size: four character heights (18h, 36h 54h, 72h), two heights are available per screen, programmable by line. - character format: 6x9 dots with character rounding function. - character colour: eight colours available pro- grammable by word. - display position: 64 horizontal positions by 2/f osc and 63 vertical positions by 4 h - word spacing: 64 positions programmable from 2/f osc to 128/f osc . - line spacing: 63 positions programmable from 4 to 252 h. - background: no background, square back- ground or fringe background programmable by word. - background colour: two of eight colours avail- able programmable by word. - display output: three character data output terminals (r,g,b) and a blank output terminal. - display on/off: display data may be pro- grammed on or off by word or entire screen. the entire screen may be blanked. format specification the entire display can be turned on or off through the use of the global enable bit or the display may be selectively turned on or off by word. to turn off the entire display, the global enable bit (ge) should be zero. if the global enable is one, the display is controlled by the word enable bits (we). theglobal enable bit is located in the global enable register and the word enable bit is located in the space character preceding the word. each line must begin with a format character which describes the format of that line and of the first word. this character is not displayed. a space character defines the format of sub- sequent words. a space character is denoted by a one in bit 6 in the display ram. if bit 6 of the display ram is a zero, the other six bits define one of the 64 display characters. the colour, background and enable can be pro- grammed by word. this information is encoded in the space character between words or in the for- mat character at the beginning of each line. five bits define the colour and background of the follow- ing word, and determine whether it will be dis- played or not. characters are stored in a 6 x 9 dot format. one dot is defined vertically as 2h (horizontal lines) and horizontally as 2/f osc if the smallest character size is enabled. there is no space between characters or lines if the vertical space enable (vse) and hori- zontal space enable (hse) bits are both zero. this allows the use of special graphics characters. the normal alphanumeric character set is format- ted to be 5 x 7 with one empty row at the top and one at the bottom and one empty column at the right. if vse and hse are both zero, then the spac- ing between alphanumeric characters is 1 dot and the spacing between lines ofalphanumeric charac- ters is 2h. the character size is programmed by line through the use of the size bit (s) in the format character and the global size bits (gs1 and gs2). the verti- cal spacing enable bit (vse) located in the format character controls the spacing between lines. if this bit is set to one, the spacing between lines is defined by the vertical spacing register, otherwise the spacing between lines is 0. the spacing between words is controlled by the horizontal space enable bit (hse) located in the space character. if this bit is set to one, the spacing between words is defined by the horizontal spacing register, otherwise the space character width of 6 dots is the spacing between words. the formats for the display character, space character and format character are described hereafter. on-screen display (osd) ? st63140,142,126,156 45/82
space character format see data ram table description for specific address ( write only) d7 d6 d5 d4 d3 d2 d1 d0 hse = horizontal spaceenab le we = word enable bit bgs = backround select b = b colour bit g = g colour bit r = r colour bit fixed to a1o unused figure 58. space character register explanation on-screen display (continued) d7. not used. d6. this pin is fixed to a1o. r, g, b. colour. the 3 colour control bits define the colour of the following word as shown in table be- low. space character register colour setting. r g b colour 0 0 0 black 0 0 1 blue 0 1 0 green 0 1 1 cyan 100 red 1 0 1 magenta 1 1 0 yellow 1 1 1 white bgs. background select. the background select bit selects the desired background for thefollowing word. there are two possible backgrounds defined by the bits in the background control register. a0o -the background on the following word is en- abled by bg0 and the colour is set by r0, g0, and b0. a1o -the background on the following word is en- abled by bg1 and the colour is set by r1, g1, and b1. we. word enable. the word enable bit defines whether or not the following word is displayed. a0o -the word is not displayed. a1o -if the global enable bit is one, then the word is displayed. hse. horizontal space enable. the horizontal space enable bit determines the spacing between words. the space between characters is always 0. the alphanumeric character set is implemented in a 5 x 7 format with one empty column to the right and one empty row above and below so that the space between alphanumeric characters will be one dot. a0o -the space between words is equal to the width of the space character, which is 6 dots. a1o -the space between words is defined by the value in the horizontal space register plus the width of the space character. format character see data ram table description for specific address ( write only) d7 d6 d5 d4 d3 d2 d1 d0 vse = vertical space enable we = word enable bit bgs = backround select b = b colour bit g = g colour bit r = r colour bit s = character size control bit unuse d figure 59. format character register explanation d7. this bit is not used s. character size. the character size bit, along with the global size bits (gs2 and gs1) located in the horizontal space register, specify the character size for each line as defined in table 14. r, g, b. colour. the 3 colour control bits define the colour of the following word as shown in table 13. bgs. background select. the background select bit selects the desired background for thefollowing word. there are two possible backgrounds defined by the bits in the background control register. a0o -the background on the following word is en- abled by bg0 and the colour is set by r0, g0, and b0. ? st63140,142,126,156 46/82
a1o -the background on the following word is en- abled by bg1 and the colour is set by r1, g1, and b1. we. word enable. the word enable bit defines whether or not the following word is displayed. a0o -the word is not displayed. a1o -if the global enable bit is one, then the word is displayed. vse. vertical space enable. the vertical space enable bit determines the spacing between lines. a0o -the space between lines is equal to 0h. the al- phanumeric character set is implemented in a 5 x 7 format with one empty column to the right and one empty row above and one below and stored in a 6 x 9 format. a1o -the space between lines is defined by the value in the vertical space register. table 13. format character register colour setting. r g b colour 0 0 0 black 0 0 1 blue 0 1 0 green 0 1 1 cyan 100 red 1 0 1 magenta 1 1 0 yellow 1 1 1 white table 14. format character register size setting gs2 gs1 s vertical height horizontal length 0 0 0 18h 6 tdot 0 0 1 36h 12 tdot 0 1 0 18h 6 tdot 0 1 1 54h 18 tdot 1 0 0 36h 12 tdot 1 0 1 54h 18 tdot 1 1 0 36h 12 tdot 1 1 1 72h 24 tdot tdot= 2/f osc on-screen display (continued) display character see data ram table description for specific addresses ( write only) d7 d6 d5 d4 d3 d2 d1 d0 c5-c0 = character types control bit fixed to a0o unuse d figure 60. display character register explanation d7. this bit is not used. d6. this bit is fixed to a0o. c5-c0. character type. the 6 character type bits define one of the 64 available character types. these character types are shown on the following pages. character types the character set is user defined as rom mask option. register and ram addressing the osd contains seven registers and 80 ram lo- cations. the seven registers are the vertical start address register, horizontal start address regis- ter, vertical space register, horizontal space reg- ister, background control register, global enable register and character bank select register. the global enable register can be written at any time by the st631xx core. the other six registers and the ram can only be read or written to if the global enable is zero. the six registers and the ram are located on two pages of the paged memory of the st631xx mcus; the character bank select register is lo- cated outside the paged memory at address edh. each page contains 64 memory locations. this paged memory is at memory locations 00h to 3fh in the st631xx memory map. a page of memory is enabled by setting the desired page bit, located in the data ram bank register, to a one. the page register is location e8h. a one in bit five selects page 5, located on the osd and a one in bit 6 se- lects page 6 on the osd. table 15 shows the ad- dresses of the osd registers and ram. ? st63140,142,126,156 47/82
table 15. osd control registers and data ram addressing page address register or ram 5 00h - 3fh ram locations 00h - 3fh 6 00h - 0fh ram locations 00h - 0fh 6 10h vertical start register 6 11h horizontal start register 6 12h vertical space register 6 13h horizontal space register 6 14h background control register 6 17h global enable register no page edh character bank select register osd global enable register this register contains the global enable bit (ge). it is the only register that can be written at any time regardless of the state of the ge bit. it is a write only register. global enable register 17h - page 6 ( write only) d7 d6 d5 d4 d3 d2 d1 d0 ge = global enable bit unused figure 61. global enable bit on-screen display (continued) d7-d1. these bits are not used ge. global enable. this bit allows the entire dis- play to be turned off. a0o - the entire display is disabled. the ram and other registers of the osd can be accessed by the core. a1o - display of words is controlled by the word en- able bits (we) located in the format or space char- acter. the other registers and ram cannot be accessed by the core. vsar vertical start address register (10h - page 6, write only) d7 d6 d5 d4 d3 d2 d1 d0 vsa5-vsa0 = vertical start address bits fr = fringe backround control bit unuse d figure 62. vertical start address register d7. this bit is not used fr. fringe background.this bit changes the back- ground from a box background to a fringe back- ground. the background is enabled by word as defined by either bg0 or bg1. a0o - the background is defined to be a box which is 7 x 9 dots. a1o - t the background is defined to be a fringe. vsa5-vsa0. vertical start address. these bits determine the start position of the first line in the vertical direction. the 6 bits can specify 63 display start positions of interval 4h. the first start position will be the fourth line of the display. the vertical start address is defined vsa0 by the following for- mula. vertical start address = 4h(2 5 (vsa5) + 2 4 (vsa4) + 2 3 (vsa3) + 2 2 (vsa2) + 2 1 (vsa1) + 2 0 (vsa0)) the case of all vertical start address bits being zero is illegal. ? st63140,142,126,156 48/82
d7. this bit is not used. sbd. space blanking disable. this bit controls whether or not the background is displayed when outputting spaces. if two background colours are used on adjacent words, then the background should not be displayed on spaces in order to make a nice break between colours. if an even background around an area of text is desired, as in a menu, then the background should be displayed when outputting spaces. a0o -the background during spaces is controlled by the background enable bits (bg0 and bg1) lo- cated in the background control register. a1o -the background is not displayed when output- ting spaces. hsa5, hsa0 - horizontal start address bits. these bits determine the start position of the first character in the horizontal direction. the 6 bits can specify 64 display start positions of interval 2/f osc or 400ns. the first start position will be at 4.0 m s be- cause of the time needed to access ram and rom before the first character can be displayed. the horizontal start address is defined by the fol- lowing formula. horizontal start address = 2/f osc (10.0 + 2 5 (hsa5) +2 4 (hsa4) + 2 3 (hsa3) + 2 2 (hsa2) + 2 1 (hsa1) + 2 0 (hsa0)) d7. this bit is not used scb. screen blanking. this bit allows the entire screen to be blanked. a0o -the blanking output signal (vblk) is active only when displaying characters. a1o -the blanking output signal (vblk) is always active. characters in the display ram are still displayed. when this bit is set to one, the screen is blanked also without setting the global enable bit to one (osd disabled). vs5 , vs0. vertical space. these bits determine the spacing between lines if the vertical space en- able bit (vse) in the format character is one. if vse is zero there will be no spaces between lines. the vertical space bits can specify one of 63 spacing values from 4h to 252h. the space between lines is defined by the following formula. space between lines = 4h(2 5 (vs5) + 2 4 (vs4) + 2 3 (vs3) + 2 2 (vs2) + 2 1 (vs1) + 2 0 (vs0)) the case of all vertical start address bits being zero is illegal. hsar horizontal start address register (11h - page 6, write only) d7 d6 d5 d4 d3 d2 d1 d0 hsa5-hsa0 = horizontal start address bits sbd = space blanking disabled bit unused figure 63. horizontal start address register on-screen display (continued) vsr vertical space register (12h - page 6, write only) d7 d6 d5 d4 d3 d2 d1 d0 vs5-vs0 = vertical space scb = screen blanking bit unuse d figure 64. vertical space register ? st63140,142,126,156 49/82
gs2,gs1. global size. these bits along with the size bit (s) located in the character format word specify the character size for each line as defined in table 16. table 16. horizontal space register size setting. gs2 gs1 s vertical height horizontal length 0 0 0 18h 6 tdot 0 0 1 36h 12 tdot 0 1 0 18h 6 tdot 0 1 1 54h 18 tdot 1 0 0 36h 12 tdot 1 0 1 54h 18 tdot 1 1 0 36h 12 tdot 1 1 1 72h 24 tdot note: tdot= 2/f osc hs5, hs0 . horizontal space . these bits deter- mine the spacing between words if the horizontal space enable bit (hse) located in the space charac- ter is a one. the space between words is then equal to the width of the space character plus the number of tdots specified by the horizontalspace bits. the 6 bits can specify one of 64 spacing values ranging from 2/f osc to 128/f osc . the formula is shown below for the smallest size character(18h). if larger size characters are being displayed the spacing between words will increase proportionately. multiply the value below by 2, 3 or 4 for character sizes of 36h, 54h and 72h respectively. space between words (not including the space character)=2/f osc (1+2 5 (hs5)+2 4 (hs4)+2 3 (hs3) +2 2 (hs2)+ 2 1 (hs1)+2 0 (hs0)) background control register this register sets up two possible backgrounds. the background select bit (bgs) in the format or space character will determine which background is selected for the current word. hsr horizontal space register (13h - page 6, write only) d7 d6 d5 d4 d3 d2 d1 d0 hs5-hs0 = horizontal space gs1 = global size bit 1 gs2 = global size bit 2 figure 65. horizontal space register on-screen display (continued) bcr backround control register (14h - page 6, write only) d7 d6 d5 d4 d3 d2 d1 d0 bk0 = backround enable bit 0 bk1 = backround enable bit 1 b0 = b colour backround bit 0 b1 = b colour backround bit 1 g0 = g colour backround bit 0 g1 = g colour backround bit 1 r0 = r colour backround bit 0 r1 = r colour backround bit 1 figure 66. background control register r1,r0,g1,g0,b1,b0. background colour . these bits define the colour of the specified back- ground, either background 1 or background 0 as defined in table 17. table 17. background register colour setting. rx gx bx colour 0 0 0 black 0 0 1 blue 0 1 0 green 0 1 1 cyan 100 red 1 0 1 magenta 1 1 0 yellow 1 1 1 white ? st63140,142,126,156 50/82
bk1,bk0. background enable.these bits deter- mine if the specified background is enabled or not. a0o -the following word doesnot havea background. a1o -there is a background around the following word. d7-d1. these bits are not used bs. bank select. this bit select the character bank to be used. the lower bank is selected with 0. the value can be modified only when the osd is off (ge=0). no reset value. cbsr character bank select register (efh - no page , write only) d7 d6 d5 d4 d3 d2 d1 d0 bs = bank select bit unused figure 67. character bank select register on-screen display (continued) osd data ram the contents of the data ram can be accessed by the st631xx mcus only when the global enable bit (ge) in the global enable register is a zero. the first character in every line is the format char- acter. this character is not displayed. it defines the size of the characters in the line and contains the vertical space enable bit. this character also de- fines the colour, background and display enable for the first word in the line. subsequent characters are either spaces or one of the 64 available charac- ter types. the space character defines the colour, back- ground, display enable and horizontal space en- able for the following word. since there are 5 display lines of 15 characters each, the display ram must contain 5 lines x (15 characters + 1 for- mat character) or 80 locations. the ram size is 80 locations x 7 bits. the data ram map is shown intable 12. ? st63140,142,126,156 51/82
column 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 a0 0101010101010101 a1 0011001100110011 a2 0000111100001111 a3 0000000011111111 page a5 a4 line 5 0 0 1 ft ch ch ch ch ch ch ch ch ch ch ch ch ch ch ch 5 0 1 2 ft ch ch ch ch ch ch ch ch ch ch ch ch ch ch ch 5 1 0 3 ft ch ch ch ch ch ch ch ch ch ch ch ch ch ch ch 5 1 1 4 ft ch ch ch ch ch ch ch ch ch ch ch ch ch ch ch 6 0 0 5 ft ch ch ch ch ch ch ch ch ch ch ch ch ch ch ch notes: ft. the format character required for each line. characters in columns 1 thru 15 are displayed. ch. (byte) character (index into osd character generator) or space character available screen space table 12. osd ram map emulator remarks there are a few differences between emulator and silicon. for noise reasons, the osd oscillator pins are not available: the internal oscillator cannot be disabled and replaced by an external coil. in the emulator, the character bank select register can be written also with global enable bit set, while this is not allowed in the device. application notes 1 - the osd character generator is composed of a dual port video ram and some circuitry. it needs two input signals vsync and hsync to syncron- ize its dedicated oscillator to the tv picture. it gen- erates 4 output signals, that can be used from the tv set to generate the characters on the screen. for instance, they can be used to feed the scart plug, providing an adequate buffer to drive the low impedance (75 w ) of the scart inputs. 2 - the core sees the osd as a number of ram locations (80) plus a certain number of control reg- isters (6). these 86 locations are mapped in two pages of the dynamic data ram address range (0h..3fh). in page 5 (load 20h in the register 0e8h), there are 64 bytes of ram, the ones of the first 4 rows (16 bytes each row, 15 characters per row maximum, plus an hidden leading formatcharacter). in page 6 (load 40h in register 0e8h), the 16 bytes of the fifth row (0..0fh), and the 6 control registers (10h..14h,17h). 3 - the video ram is a dual port ram. that means that it can be addressed either from the core or from the osd circuitry itself. to reduce the com- plexity of the circuitry, and thus its cost, some re- strictions have been introduced in the use of the osd. a. the core can only write to any of the 86 loca- tions (either video ram or control registers). b. the core can only write to any of the leading 85 locations when the osd oscillator is off. only the last location (control register 17h in page 6) can be addressed at any time. this is the global enable register, which contains only the ge bit. if it is set, the osd is on, if it is reset the osd is off. 4 - the timing of the on/off switching of the osd oscillator is the following: a. ge bit is set. the osd oscillator will start on the next vsync signal. b. ge bit is reset. the osd oscillator will be im- mediately switched off. on-screen display (continued) ? st63140,142,126,156 52/82
to avoid a bad visual impression, it is important that the ge bit is set before the end of the flyback time when changing characters. this can be done inside the vsync interrupt routine. the following diagram can explain better: notes: a - picture time: 20 ms in pal/secam. b - vsync interrupt, if enabled. c - starting of osd oscillator, if ge = 1. d - flyback time. when modifying the picture display (i.e.: a bar graph for an analog control), it is important that the switching on of the ge bit is done before the the end of the flyback time (d in figure 68). if the ge bit is set after the end of the flyback time then the osd will not start until the begining of the next frame. this results in one frame being lost and will result in a flicker on the screen. one method to be sure to avoid the flicker is to wait for the vsync in- terrupt at the start of the flyback; once the vsync interrupt is detected, then the ge bit can be set to zero, the characters changed, and the ge set to one. all this should occur before the end of the fly- back time in order not to lose a frame. the correct edge of the interrupt must be chosen. the vsync pin may alternatively be sampled by software in order to know the status; this can be done by reading bit 4 of register e4h; this bit is in- verted with respect to the vsync pin. 6 - an osd end of line bar is present in the st63p1xx piggyback and st631xx rom, eprom and otp devices when using the background mode. if this bar is present with software running in the piggybacks then it is also present on the rom mask version. if the end of line bar is seen to be eliminated by software in the piggyback, then it is also be eliminated in the rom mask version. the bar appears at the end of the line in the back- ground mode when the last character is a space character, the first format character is defined with s=0 (size 0)and the backround is not displayed during the space. the bar is the colour of the back- ground defined by the space character. to elimi- nate the bar: a. if two backgrounds are used then the bar should be moved off the screen by using large word spaces instead of character spaces. if there are not enough spaces before the end of the line, then the location of the valid charac- ters should be moved so they appear at the end of the line (and hence no bar); positioning can be compensated using the horizontal start register. b. if only one background is used, then the other background should be transparent in order to eliminate the bar. 7 - the osd oscillator external network should consist of a capacitor on each of the osd oscillator pins to ground together with an inductance be- tween pins. the user should select the two capaci- tors to be the same value (15pf to 25pf each is recommended). the inductance is chosen to give the desired osd oscillator frequency for the appli- cation (typically 56 m h ). figure 68. osd oscillator on/off timing on-screen display (continued) ? st63140,142,126,156 53/82
the st631xx software has been designed to fully use the hardware in the most efficient way possible while keeping byte usage to a minimum; in short to provide byte efficient programming capability. the st631xx core has the ability to set or clear any register or ram location bit of the data space with a single instruction. furthermore, the program may branch to a selected address depending on the status of any bit of the data space. the carry bit is stored with the value of the bit when the set or res instruction is processed. addressing modes the st631xx core has nine addressing modes which are described in the following paragraphs. the st631xx core uses three different address spaces : program space, data space, and stack space. program space contains the instructions which are to be executed, plus the data for imme- diate mode instructions. data space contains the accumulator, the x,y,v and w registers, peripheral and input/outputregisters, the ram locations and data rom locations (for storage of tables and constants). stack space contains six 12-bit ram cells used to stack the return addresses for subrou- tines and interrupts. immediate. in the immediate addressing mode, the operand of the instruction follows the opcode location. as the operand is a rom byte, the imme- diate addressing mode is used to access constants which do not change during program execution (e.g., a constant used to initialize a loop counter). direct. in the direct addressing mode, the address of the byte that is processed by the instruction is stored in the location that follows the opcode. direct addressing allows the user to directly address the 256 bytes in data space memory with a single two-byte instruction. short direct. the core can address the four ram registers x,y,v,w (locations 80h, 81h, 82h, 83h) in the short-direct addressing mode. in this case, the instruction is only one byte and the selection of the location to be processed is contained in the op- code. short direct addressing is a subset of the direct addressing mode. (note that 80h and 81h are also indirect registers). extended. in the extended addressing mode, the 12-bit address needed to define the instruction is obtained by concatenating the four less significant bits of the opcode with the byte following the op- code. the instructions (jp, call) that use the extended addressing mode are able to branch to any address of the 4k bytes program space. an extended addressing mode instruction is two- byte long. program counter relative. the relative address- ing mode is only used in conditional branch instruc- tions. the instruction is used to perform a test and, if the condition is true, a branch with a span of -15 to +16 locations around the address of the relative instruction. if the condition is not true, the instruc- tion that follows the relative instruction is executed. the relative addressing mode instruction is one- byte long. the opcode is obtained in adding the three most significant bits that characterize the kind of the test, one bit that determines whether the branch isa forward (when it is 0) or backward (when it is 1) branch and the four less significant bits that give the span of the branch (0h to fh) that must be added or subtracted to the address of the relative instruction to obtain the address of the branch. bit direct. in the bit direct addressing mode, the bit to be set or cleared is part of the opcode, and the byte following the opcode points to the address of the byte in which the specified bit must be set or cleared. thus, any bit in the 256 locations of data space memory can be set or cleared. bit test & branch. the bit test and branch ad- dressing mode is a combination of direct address- ing and relative addressing. the bit test and branch instruction is three-byte long. the bit identification and the tested condition are included in the opcode byte. the address of the byte to be tested follows immediately the opcode in the program space. the third byte is the jump displacement, which is in the range of -126 to +129. this displacement can be determined using a label, which is converted by the assembler. indirect. in the indirect addressing mode, the byte processed by the register-indirect instruction is at the address pointed by the content of one of the indirect registers, x or y (80h,81h). the indirect register is selected by the bit 4 of the opcode. a register indirect instruction is one byte long. inherent. in the inherent addressing mode, all the information necessary to execute the instruction is contained in the opcode. these instructions are one byte long. software description ? st63140,142,126,156 54/82
instruction set the st631xx core has a set of 40 basic instruc- tions. when these instructions are combined with nine addressing modes, 244 usable opcodes can be obtained. they can be divided into six different types:load/store, arithmetic/logic, conditional branch, control instructions, jump/call, bit manipu- lation. the following paragraphs describe the dif- ferent types. all the instructions within a given type are pre- sented in individual tables. load & store. these instructions use one,two or three bytes in relation with the addressing mode. one operand is the accumulator for load and the other operand is obtained from data memory using one of the addressing modes. for load immediate one operand can be any of the 256 data space bytes while the other is always immediate data. see table 13. instruction addressing mode bytes cycles flags zc ld a, x short direct 1 4 d * ld a, y short direct 1 4 d * ld a, v short direct 1 4 d * ld a, w short direct 1 4 d * ld x, a short direct 1 4 d * ld y, a short direct 1 4 d * ld v, a short direct 1 4 d * ld w, a short direct 1 4 d * ld a, rr direct 2 4 d * ld rr, a direct 2 4 d * ld a, (x) indirect 1 4 d * ld a, (y) indirect 1 4 d * ld (x), a indirect 1 4 d * ld (y), a indirect 1 4 d * ldi a, #n immediate 2 4 d * ldi rr, #n immediate 3 4 * * notes: x,y. indirect register pointers, v & w short direct registers # . immediate data (stored in rom memory) rr. data space register d . affected * . not affected table 13. load & store instructions software description (continued) ? st63140,142,126,156 55/82
software description (continued) arithmetic and logic. these instructions are used to perform the arithmetic calculations and logic operations. in and, add, cp, sub instruc- tions one operand is always the accumulatorwhile the other can be either a data space memory content or an immediate value in relation with the addressing mode. in clr, dec, inc instructions the operand can be any of the 256 data space addresses. in com, rlc, sla the operand is always the accumulator. see table 14. instruction addressing mode bytes cycles flags zc add a, (x) indirect 1 4 dd add a, (y) indirect 1 4 dd add a, rr direct 2 4 dd addi a, #n immediate 2 4 dd and a, (x) indirect 1 4 d * and a, (y) indirect 1 4 d * and a, rr direct 2 4 d * andi a, #n immediate 2 4 d * clr a short direct 2 4 dd clr rr direct 3 4 * * com a inherent 1 4 dd cp a, (x) indirect 1 4 dd cp a, (y) indirect 1 4 dd cp a, rr direct 2 4 dd cpi a, #n immediate 2 4 dd dec x short direct 1 4 d * dec y short direct 1 4 d * dec v short direct 1 4 d * dec w short direct 1 4 d * dec a direct 2 4 d * dec rr direct 2 4 d * dec (x) indirect 1 4 d * dec (y) indirect 1 4 d * inc x short direct 1 4 d * inc y short direct 1 4 d * inc v short direct 1 4 d * inc w short direct 1 4 d * inc a direct 2 4 d * inc rr direct 2 4 d * inc (x) indirect 1 4 d * inc (y) indirect 1 4 d * rlc a inherent 1 4 dd sla a inherent 2 4 dd sub a, (x) indirect 1 4 dd sub a, (y) indirect 1 4 dd sub a, rr direct 2 4 dd subi a, #n immediate 2 4 dd notes: x,y. indirect register pointers, v & w short direct registers d . affected # . immediate data (stored in rom memory) * . not affected rr. data space register table 14. arithmetic & logic instructions ? st63140,142,126,156 56/82
software description (continued) conditional branch. the branch instructions achieve a branch in the program when the selected condition is met. see table 15. bit manipulation instructions. these instruc- tions can handle any bit in data space memory. one group either sets or clears. the other group (see conditional branch) performs the bit test branch operations. see table 16. control instructions. the control instructions control the mcu operations during program execu- tion. see table 17. jump and call. these two instructions are used to perform long (12-bit) jumps or subroutines call inside the whole program space. refer to table 18. instruction branch if bytes cycles flags zc jrc e c = 1 1 2 * * jrnc e c = 0 1 2 * * jrz e z = 1 1 2 * * jrnz e z = 0 1 2 * * jrr b, rr, ee bit = 0 3 5 * d jrs b, rr, ee bit = 1 3 5 * d notes: b. 3-bit address rr. data space register e. 5 bit signed displacement in the range -15 to +16 d . affected ee. 8 bit signed displacement in the range -126 to +129 * . not affected table 15. conditional branch instructions instruction addressing mode bytes cycles flags zc set b,rr bit direct 2 4 * * res b,rr bit direct 2 4 * * notes: b. 3-bit address; * . not affected rr. data space register; table 16. bit manipulation instructions instruction addressing mode bytes cycles flags zc nop inherent 1 2 * * ret inherent 1 2 * * reti inherent 1 2 dd stop (1) inherent 1 2 * * wait inherent 1 2 * * notes: 1. this instruction is deactivated and a waitis automatically executed instead of a stop if the hardware activated watchdog function is selected. d . affected * . not affected table 17. control instructions instruction addressing mode bytes cycles flags zc call abc extended 2 4 * * jp abc extended 2 4 * * notes: abc.12-bit address; * . not affected table 18. jump & call instructions ? st63140,142,126,156 57/82
software description (continued) opcode map summary. the following table containsan opcode map for the instructions used on the mcu. low 01234567 0000 0001 0010 0011 010 0 0101 0110 0111 hi 0 00 00 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 ld e abc e b0 ,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 1 00 01 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc 4 ldi e abc e b0 ,rr,ee e x e a,n n 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm 2 00 10 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 cp e abc e b4 ,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 3 0011 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc 4 cpi e abc e b4 ,rr,ee e a,x e a,nn 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm 4 01 00 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 add e abc e b2 ,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 5 0101 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc 4 addi e abc e b2 ,rr,ee e y e a,n n 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm 6 0110 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 inc e abc e b6 ,rr,ee e # e (x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 7 0111 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc e abc e b6 ,rr,ee e a,y e # 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 8 1000 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 ld e abc e b1 ,rr,ee e # e (x),a 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind 9 1001 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc e abc e b1 ,rr,ee e v e # 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc a 1010 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 and e abc e b5 ,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind b 1011 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc 4 andi e abc e b5 ,rr,ee e a,v e a,nn 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm c 1100 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 sub e abc e b3 ,rr,ee e # e a,(x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind d 1101 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 inc 2 jrc 4 subi e abc e b3 ,rr,ee e w e a,n n 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm e 1110 2 jrnz 4 call 2 jrnc 5 jrr 2 jrz 2 jrc 4 dec e abc e b7 ,rr,ee e # e (x) 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind f 1111 2 jrnz 4 call 2 jrnc 5 jrs 2 jrz 4 ld 2 jrc e abc e b7 ,rr,ee e a,w e # 1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc low 89 abcdef 10 00 1001 1010 1011 1100 1101 1110 1111 hi 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 4 ldi 2 jrc 4 ld 0 0000 e abc e b0 ,rr e rr,nn e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 3 imm 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 ld 1 0001 e abc e b0 ,rr e x e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 4 com 2 jrc 4 cp 2 0010 e abc e b4 ,rr e a e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 cp 3 0011 e abc e b4 ,rr e x,a e a,rr 1 pcr 2 ext 1 pcr 2 b.d. 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 reti 2 jrc 4 add 4 0100 e abc e b2 ,rr e e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 add 5 0101 e abc e b2 ,rr e y e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 stop 2 jrc 4 inc 6 0110 e abc e b6 ,rr e e (y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 inc 7 0111 e abc e b6 ,rr e y,a e rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 jrc 4 ld 8 1000 e abc e b1 ,rr e # e (y),a 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 ld 9 1001 e abc e b1 ,rr e v e rr,a 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 4 rlc 2 jrc 4 and a 1010 e abc e b5 ,rr e a e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 and b 1011 e abc e b5 ,rr e v,a e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 ret 2 jrc 4 sub c 1100 e abc e b3 ,rr e e a,(y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 dec 2 jrc 4 sub d 1101 e abc e b3 ,rr e w e a,rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir 2 jrnz 4 jp 2 jrnc 4 res 2 jrz 2 wait 2 jrc 4 dec e 1110 e abc e b7 ,rr e e (y) 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 pcr 1 ind 2 jrnz 4 jp 2 jrnc 4 set 2 jrz 4 ld 2 jrc 4 dec f 1111 e abc e b7 ,rr e w,a e rr 1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 pcr 2 dir abbreviations for addressing modes: legend: dir direct # indicates illegal instructions sd short direct e 5 bit displacement imm immediate b 3 bit address inh inherent rr1byte dataspace address ext extended nn 1 byte immediate data b.d bit direct abc 12 bit address bt bit test ee 8 bit displacement pcr program counter relative ind indirect cycles 2 jrc mnemonic operand e bytes 1 pcr addressing mode ? st63140,142,126,156 58/82
absolute maximum ratings this product contains devices to protect the inputs against damage due to high static voltages, how- ever it is advised to take normal precaution to avoid application of any voltage higher than maximum rated voltages. for proper operation it is recommended that v i and v o must be higher than v ss and smaller than v dd . reliability is enhanced if unused inputs are con- nected to an appropriated logic voltage level (v dd or v ss ). power considerations. the average chip-junc- tion temperature, tj, in celsius can be obtained from : tj = t a + pd x rthja where :t a = ambient temperature. rthja = package thermal resistance (junction-to ambient). pd = pint + pport. pint = i dd xv dd (chip internal power). pport = port power dissipation (determinated by the user). symbol parameter value unit v dd supply voltage -0.3 to 7.0 v v i input voltage (afc in) v ss - 0.3 to +13 v v i input voltage (other inputs) v ss - 0.3 to v dd +0.3 v v o output voltage (pa4-pa7, pc4-pc7, da0-da5) v ss - 0.3 to +13 v v o output voltage (other outputs) v ss - 0.3 to v dd +0.3 v i o current drain per pin excluding v dd ,v ss , pa6, pa7 10 ma i o current drain per pin (pa6, pa7) 50 ma iv dd total current into v dd (source) 50 ma iv ss total current out of v ss (sink) 150 ma tj junction temperature 150 c t stg storage temperature -60 to 150 c note : stresses above those listed as aabsolute maximum ratingso may cause permanent damage to the device . this is a stress rating only and functional operation of the device at these conditions is not implied. exposure to maximum rating conditions for extended periods may affect device reliability. symbol parameter test conditions value unit min. typ. max. rthja thermal resistance pdip40 pdip28 38 55 c/w thermal characteristic symbol parameter test conditions value unit min. typ. max. t a operating temperature 0 70 c v dd operating supply voltage 4.5 5.0 6.0 v f osc oscillator frequency run & wait modes 8 8.1 mhz f osdosc on-screen display oscillator frequency 8.0 mhz recommended operating conditions ? st63140,142,126,156 59/82
the st631xx eeprom single poly process has been specially developed to achieve 300.000 write/erase cycles and a 10 years data retention. symbol parameter test conditions value unit min. typ. max. v il input low level voltage all i/o pins, kby0-2 0.3xv dd v v ih input high level voltage all i/o pins, kby0-2 0.75xv dd v v hys hysteresis voltage (1) all i/o pins, kby0-2 v dd =5v 1.0 v v ol low level output voltage port b/c, da0-3, bsw0-3, out1, vs, osd outputs, v dd = 4.5v i ol = 1.6ma i ol = 5.0ma 0.4 1.0 v v v ol low level output voltage port a v dd = 4.5v i ol = 3.2ma i ol = 30ma 0.4 1.0 v v v ol low level output voltage osdoscout, oscout v dd = 4.5v i ol = 0.1ma 0.4 v v oh high level output voltage port b/c (2) ,vs v dd = 4.5v i oh = 1.6ma 4.1 v v oh high level output voltage osdoscout, oscout, v dd = 4.5v i ol = 0.1ma 4.1 v i pu input pull up current input mode with pull-up port b/c, kby0-2 v in =v ss (2) 100 50 25 ma i il i ih input leakage current oscin v in =v ss v in =v dd 10 0.1 1 1 0.1 10 m a i il i ih input leakage current all i/o input mode no pull-up osdoscin v in =v dd or v ss 10 10 m a i il i ih input leakage current reset pin with pull-up v in =v ss 50 30 10 m a i il i ih input leakage current afc pin v ih =v dd v il =v ss v ih = 12.0v 1 1 40 m a i oh output leakage current port a, da0-3, bsw0-3 out1, osdout v oh =v dd 10 m a i oh output leakage current high voltage port a, da0-3, bsw0-3 out1 v oh = 12v 40 m a dc electrical characteristics (t a = 0 to +70 c unless otherwise specified) eeprom information ? st63140,142,126,156 60/82
symbol parameter test conditions value unit min. typ. max. i dd supply current run mode f osc = 8mhz, iload= 0ma v dd = 6.0v 616ma i dd supply current wait mode f osc = 8mhz, iload= 0ma v dd =6v 310ma v on reset trigger level on reset pin 0.3xv dd v v off reset trigger level off reset pin 0.8xv dd v v ta input level absolute tolerance a/d afc pin v dd =5v 200 mv v tr input level relatice tolerance a/d afc pin relative to other levels v dd =5v 100 mv notes : 1. not 100% tested 2. input pull-up option only dc electrical characteristics (continued) ? st63140,142,126,156 61/82
symbol parameter test conditions value unit min. typ. max. t wres minimum pulse width reset pin 125 ns to hl high to low transition time pa6, pa7 v dd = 5v, cl = 1000pf (2) 100 ns to hl high to low transition time da0-da5, pb0-pb6, osd outputs, pc0-pc7, v dd = 5v, cl = 100pf 20 ns to lh low to high transition time pb0-pb6, pa0-pa3, osd outputs, pc0-pc3 v dd = 5v, cl = 100pf 20 ns to h data hold time spi after clock goes low i 2 cbus/s-bus only 175 ns f da d/a converter repetition frequency (1) 31.25 khz f sio sio baud rate (1) 62.50 khz t wee eeprom write time t a =25 c one byte 5 10 ms endurance eeprom write/erase cycles q a l ot acceptance criteria 300.000 >1 million cycles retention eeprom data retention (4) t a =25 c 10 years c in input capacitance (3) all inputs pins 10 pf c out output capacitance (3) all outputs pins 10 pf coscin, coscout oscillator pins internal capacitance(3) 5pf cosdin, cosdout osd oscillator external capacitance recommended 15 25 pf notes: 1. a clock other than 8 mhz will affect the frequency response of those peripherals (d/a, 62.5khz and spi) whose clock is derived from the system clock. 2. the rise and fall times of port a have been reduced in order to avoid current spikes while maintaining a high drive capability 3. not 100% tested 4. based on extrapolated data ac electrical characteristics (t a = 0 to +70 c, f osc =8mhz, v dd =4.5 to 6.0v unless otherwise specified ) ? st63140,142,126,156 62/82
package mechanical data figure 69. st631xx 40 pin plastic dual-in-line package figure 70. st631xx 28-pin dual-in-line package dim. mm inches min typ max min typ max a 2.2 4.8 0.086 0.189 a1 0.51 1.77 0.010 0.069 b 0.38 0.58 0.015 0.023 b1 0.97 1.52 0.055 0.065 c 0.20 0.30 0.008 0.009 d 50.30 52.22 1.980 20.560 d1 e 15.2 0.600 e1 12.9 0.508 k1 k2 l 3.18 4.44 1.25 0.174 e1 2.54 0.10 number of pins n40 dim. mm inches min typ max min typ max a 2.2 4.8 0.086 0.189 a1 0.51 1.77 0.010 0.069 b 0.38 0.58 0.015 0.023 b1 0.97 1.52 0.055 0.065 c 0.20 0.30 0.008 0.009 d 35.06 36.22 1.400 1.425 d1 e 15.2 0.600 e1 12.9 0.508 k1 k2 l 3.18 4.44 1.25 0.174 e1 2.54 0.10 number of pins n28 ? st63140,142,126,156 63/82
rom page device address eprom address (1) description page 0 0000h-007fh 0080h-07ffh 0000h-007fh 0080h-07ffh reserved user rom page 1 astatico 0800h-0f9fh 0fa0h-0fefh 0ff0h-0ff7h 0ff8h-0ffbh 0ffch-0ffdh 0ffeh-0fffh 0800h-0f9fh 0fa0h-0fefh 0ff0h-0ff7h 0ff8h-0ffbh 0ffch-0ffdh 0ffeh-0fffh user rom reserved interrupt vectors reserved nmi vector reset vector page 2 0000h-000fh 0010h-07ffh 1000h-100fh 1010h-17ffh reserved user rom page 3 0000h-000fh 0010h-07ffh 1800h-180fh 1810h-1fffh reserved user rom note 1. eprom addresses are related to the use of st63e1xx eprom emulation devices. table 19. rom memory map ordering information the following chapter deals with the procedure for transfer the program/data rom codes to sgs- thomson. communication of the rom codes. to commu- nicate the contents of program /data rom memo- ries to sgs-thomson, the customer has to send a 5o diskette with: one file in intel intellec 8/mds format for the program memory one file in intel intellec 8/mds format for the odd and even odd osd characters one file in intel intellec 8/mds format for the eeprom initial content (this file is optional) a filled option list form as described in the option list paragraph. the program rom should respect the rom mem- ory map as in table 19. the rom code must be generated with st6 as- sembler. before programming the eprom, the buffer of the eprom programmer must be filled with ffh. ? st63140,142,126,156 64/82
figure 71. osd test character customer eeprom initial contents: format a. the content should be written into an intel intellec format file. b. undefined or don't care bytes should have the content ffh. osd test character. in order to allow the testing of the on-chip osd macrocell the following character must be pro- vided at the fixed 3fh (63) position of the second osd bank. listing generation & verification. when sgs- thomson receives the files, a computer listing is generated from them. this listing refers extractly to the mask that will be used to produce the microcon- troller. then the listing is returned to the customer that must thoroughly check, complete, sign and return it to sgs-thomson. the signed list consti- tutes a part of the contractual agreement for the creation of the customer mask. sgs-thomson sales organization will provide detailed information on contractual points. sales type rom/eeprom temperature range package st63140b1/xx 8k (eprom) / 128 bytes 0to +70 c pdip28 st63142b1/xx 0 to + 70 c pdip28 st63126b1/xx 0 to + 70 c pdip40 st63156b1/xx 0 to + 70 c pdip40 note. / xx is the rom code idebtifier that is allocated by sgs-thomson after receipt of all required options and the related rom file ordering information table ordering information (continued) ? st63140,142,126,156 65/82
st631xx microcontroller option list customer: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . address: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . contact: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . phone no: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . reference: . . . . . . . . . . . . ............................. device [ ] st63140 [ ] st63142 [ ] st63126 [ ] st63156 temperature range 0 to 70 c for marking one line with 12 characters maximum is possible special marking [ ] no [ ] yes line1 a _ _ _ _ _ _ _ _ _ _ _ _ o letters, digits, ' . ', ' - ', ' / ' and spaces only the default marking is equivalent to the sales type only (part number). osd polarity options (put a cross on selected item) : positive negative vsync,hsync [ ] [ ] r,g,b [ ] [ ] blank [ ] [ ] check list: yes no rom code [ ] [ ] osd code: odd & even [ ] [ ] eeprom code (if desired) [ ] [ ] signature ................................... date ........................................... ? st63140,142,126,156 66/82
? 8-bit eprom hcmos mcus for tv frequency & voltage synthesis with osd st63e140/t140, e142/t142 st63e126/t126, e156/t156 4.5 to 6v operating range 8mhz maximum clock frequency user program eprom: 7948 bytes reserved test eprom: 244 bytes data eprom: user selectable size data ram: 256 bytes data eeprom: 128 bytes 40-pin dual in line package for the st63x126, x156 28-pin dual in line package for the st63x140, x142 up to 18 software programmable general purpose inputs/outputs, including 8 direct led driving outputs 3 inputs for keyboard scan (kby0-2) up to 4 high voltage outputs (bsw0-3) two timers each including an 8-bit counter with a 7-bit programmable prescaler digital watchdog function serial peripheral interface (spi) supporting s-bus/ i 2 c bus and standard serial protocols up to four 6-bit pwm d/a converters 62.5khz output pin 14 bit counter for voltage synthesis tuning (st63156, st63140) afc a/d converter with 0.5v resolution four interrupt vectors (irin/nmi, timer 1 & 2, vsync.) on-chip clock oscillator 5 lines by 15 characters on-screen display generator with 128 characters (2 banks) these eprom and otp versions are fully pin to pin compatible with their respective rom versions the development tool of the st631xx microcontrollers consists of the st63tvs-emu emulation and development system to be connected via a standard rs232 serial line to an ms-dos personal computer. eprom programming board st63e1xx-epb this is preliminary information from sgs-thomson. details are subject to change without notice. october 1993 preliminary data 1 1 28 1 1 (ordering information at the end of the datasheet) 67/82
figure 1. st63e126/t126, e156/t156 pin configuration figure 2. st63e140/t140, e142/t142 pin configuration da0 da3 pc5 (r) irin out1 da1 da2 pa1 (scl) pb5 (sda) pb6 12 11 10 9 (sen) pb7 kby2 kby kby0 8 7 6 5 bsw3 bsw2 bsw0 4 3 2 1 pa3 pa2 21 22 pa4 reset oscin oscout pc1 23 24 25 26 27 28 pa5 pa6 test afc (vsync) pb2 (hsync) pb3 osdoscin osdoscout 29 30 31 32 33 34 35 pc6 (g) pc7 (b) 36 37 38 39 40 va00282 v dd 13 14 15 16 17 18 19 20 v ss 1 bsw1 pc3 (blank) pc2 (on/off) (1) pc0 da0 da3 pc5 (r) irin out1 da1 da2 pa1 (scl) pb5 (sda) pb6 12 11 10 9 (sen) pb7 kby2 kby kby0 8 7 6 5 bsw3 bsw2 bsw0 4 3 2 1 pa3 pa2 21 22 pa4 reset oscin oscout pc1 23 24 25 26 27 28 pa5 pa6 test afc (vsync) pb2 (hsync) pb3 osdoscin osdoscout 29 30 31 32 33 34 35 pc6 (g) pc7 (b) 36 37 38 39 40 va00288 v dd 13 14 15 16 17 18 19 20 v ss 1 bsw pc3 (blank) pc2 (on/off) vs (1) bsw0 bsw1 bsw2 kby0 kby1 kby2 osdoscout osdoscin pb3 (hsync) pb2 (vsync) afc test pa4 v da0 out1 vs pc6 (g) pc4 pc3 (blank) pc2 oscout oscin reset pa0 pa1 pa2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 vr001389 dd v ss (1) bsw0 bsw1 bsw2 kby0 kby1 kby2 osdoscout osdoscin pb3 (hsync) pb2 (vsync) afc test pa4 v v da0 out1 irin pc6 (g) pc5 (r) pc4 pc2 oscout oscin reset pa0 pa1 pa2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 vr001390 dd ss (1) st63e126/t126 st63e156/t156 note 1. this pin is also the v pp input for eprom based devices st63e140/t140 st63e142/t142 note 1. this pin is also the v pp input for eprom based devices ? st63e140,e142,e126,e156, t140,t142,t126,t156 68/82
general description the st63e140/t140, e142/t142, e126/t126, e156/t156 microcontrollers are members of the 8- bit hcmos st631xx family, a series of devices specially oriented to tv applications. different pe- ripheral configurations are available to give the maximum application and cost flexibility. all st631xx members are based on a building block approach: a common core is surrounded by a com- bination of on-chip peripherals (macrocells) avail- able from a standard library. these peripherals are designed with the same core technology providing full compatibility and short design time. many of these macrocells are specially dedicated to tv ap- plications. the macrocells of the st631xx family are: two timer peripherals each including an 8-bit counter with a 7-bit software programmable prescaler (timer), a digital hardware activated watchdog function (dhwd), a 14-bit voltage synthesis tuning peripheral, a serial peripheral interface (spi), up to four 6-bit pwm d/a converters, an afc a/d con- verter with 0.5v resolution, an on-screen display (osd) with 15 characters per line and 128 charac- ters (in two banks each of 64 characters). in addi- tion the following memory resources are available: program eprom (8k), data ram (256 bytes), eeprom (128 bytes). refer to pin configuration figures and to st631xx device summary (table 1) for the definition of st631xx family members and a summary of differ- ences among the different types. ? st63e140,e142,e126,e156, t140,t142,t126,t156 69/82
stack level 1 stack level 2 stack level 3 stack level 4 stack level 5 stack level 6 pc d/aoutputs timer 2 ir interrupt input test timer 1 port c port b port a vs output & afc input on-screen display digital watchdog/timer serial peripheral interface v dd v ss oscin osdoscin osdoscout oscout reset r, g, b, blank hsync (pb3) vsync (pb2) vr01753f pa0 - pa7 * da0 - da3 irin/nmi test/v pp afc & vs * pb2 - pb7 * pc0 - pc7 * power supply oscillator reset 8-bit core user program eprom 8 kbytes data rom user selectable data eeprom 128 bytes data ram 256 bytes * refer to pin configuration for additional information figure 3. st631xx family block diagram device eprom (bytes) otp rom (bytes) ram (bytes) eeprom (bytes) i/o kby i/o bsw out afc vs d/a pack. target rom devices st63e140 8k 256 128 6 3 3 yes yes 1 pdip28 st63140 st63t140 8k 256 128 6 3 3 yes yes 1 pdip28 st63140 st63e142 8k 256 128 6 3 3 yes no 1 pdip28 st63142 st631t42 8k 256 128 6 3 3 yes no 1 pdip28 st63142 st63e126 8k 256 128 12 3 4 yes no 4 pdip40 st63126 st63t126 8k 256 128 12 3 4 yes no 4 pdip40 st63126 st63e156 8k 256 128 11 3 4 yes yes 4 pdip40 st63156 st63t156 8k 256 128 11 3 4 yes yes 4 pdip40 st63156 table 1. device summary ? st63e140,e142,e126,e156, t140,t142,t126,t156 70/82
pin description v dd and v ss . power is supplied to the mcu using these two pins. v dd is power and v ss is the ground connection. oscin, oscout. these pins are internally con- nected to the on-chip oscillator circuit. a quartz crystal or a ceramic resonator can be connected between these two pins in order to allow the cor- rect operation of the mcu with various stabil- ity/cost trade-offs. the oscin pin is the input pin, the oscout pin is the output pin. reset. the active low reset pin is used to start the microcontroller to the beginning of its program. test/v pp . the test pin must be held at v ss for normal operation. if this pin is connected to a 12.5v level during the reset phase, the eprom programming mode is entered. caution . exceeding 13v on test/v pp pin will per- manently damaged the device. pa0-pa7. these 8 lines are organized as one i/o port (a). each line may be configured as either an input or as an output under software control of the data direction register. port a has an open-drain (12v drive) output configuration with direct led driving capability (30ma, 1v). pb2-pb3, pb5-pb7. these lines are organized as one i/o port (b). each line may be configured as either an input with or without internal pull-up resis- tor or as an output under software control of the data direction register. pb2-pb3 have a push-pull configuration in output mode while pb5-pb7 are open-drain (5v drive). pb2 and pb3 lines are connected to the vsync and hsync control signals of the osd cell; to pro- vide the right signals to the osd these i/o lines should be programmed in input mode and the user can read aon the flyo the state of vsync and hsync signals. pb2 is also connected with the vsync interrupt. the active polarity of vsync in- terrupt signal is software controlled. the active po- larity of these synchronization input pins to the osd macrocell can be selected by the user as rom mask option. if the device is specified to have negative logic inputs, then when these signals are low the osd oscillator stops. if the device is speci- fied to have positive logic inputs, then when these signals are high the osd oscillator stops. pb5, pb6 and pb7 lines, when in output modes, are aandedo with the spi control signals. pb5 is connected with the spi clock signal (scl), pb6 with the spi data signal (sda) while pb7 is con- nected with spi enable signal (sen). pc0-pc7. these 8 lines are organized as one i/o port (c). each line may be configured as either an input with or without internal pull-up resistor or as an output under software control of the data direc- tion register. pc0-pc2, pc4 have a push-pull con- figuration in output mode while pc3, pc5-pc7 (osd signals) are open-drain (5v drive). pc3, pc5 , pc6 and pc7 lines when in output mode are aandedo with the character and blank signals of the osd cell. pc3 is connected with the osd blank signal, pc5, pc6 and pc7 with the osd r, g and b signals. the active polarity of these sig- nals can be selected by the user as rom mask op- tion. pc2 is also used as tv set on-off switch (5v drive). da0-da3. these pins are the four pwm d/a out- puts (with 32khz repetition) of the 6-bit on-chip d/a converters. the pwm function can be disabled by software and these lines can be used as general purpose open-drain outputs (12v drive). irin. this pin is the external nmi of the mcu. out1. this pin is the 62.5khz output specially suited to drive multi-standard chroma processors. this function can be disabled by software and the pin can be used as general purpose open-drain output (12v drive). bsw0-bsw3. these output pins can be used to select up to 4 tuning bands. these lines are config- ured as open-drain outputs (12v drive). kby0-kby2. these pins are input only and can be used for keyboard scan. they have cmos thresh- old levels with schmitt trigger and on-chip 100k w pull-up resistors. afc. this is the input of the on-chip 10 level com- parator that can be used to implement the afc function. this pin is an high impedance input able to withstand signals with a peak amplitude up to 12v. osdoscin, osdoscout. these are the on screen display oscillator terminals. an oscillation capacitor and coil network have to be connected to provide the right signal to the osd. vs. this is the output pin of the on-chip 14-bit volt- age synthesis tuning cell (vs). the tuning signal present at this pin gives an approximate resolution of 40khz per step over the uhf band. this line is a push-pull output with standard drive (st63140, st63156 only). ? st63e140,e142,e126,e156, t140,t142,t126,t156 71/82
pin function description da0 to da3 output, open-drain, 12v bsw0 to bsw3 output, open-drain, 12v irin input, resistive bias, schmitt trigger afc input, high impedance, 12v out1 output, open-drain, 12v kby0 to kby2 input, pull-up, schmitt trigger r,g,b, blank output, open-drain, 5v hsync, vsync input, pull-up, schmitt trigger osdoscin input, high impedance osdoscout output, push-pull test/v pp input, pull-down oscin input, resistive bias, schmitt trigger to reset logic only oscout output, push-pull reset input, pull-up, schmitt trigger input vs output, push-pull pa0-pa6 i/o, open-drain, 12v, no input pull-up, schmitt trigger, high drive pb2-pb3, pb5-pb7 i/o, push-pull, 5v, input pull-up, schmitt trigger pb5-pb7 i/o, open-drain, 5v, input pull-up, schmitt trigger pc0-pc2, pc4 i/o, push-pull, 5v, input pull-up, schmitt trigger pc3, pc5-pc7 i/o, open-drain, 5v, input pull-up, schmitt trigger v dd ,v ss power supply pins table 2. pin summary pin description (continued) ? st63e140,e142,e126,e156, t140,t142,t126,t156 72/82
memory space eprom page device address eprom address description page 0 0000h-007fh 0080h-07ffh 0000h-007fh 0080h-07ffh reserved user rom page 1 astatico 0800h-0f9fh 0fa0h-0fefh 0ff0h-0ff7h 0ff8h-0ffbh 0ffch-0ffdh 0ffeh-0fffh 0800h-0f9fh 0fa0h-0fefh 0ff0h-0ff7h 0ff8h-0ffbh 0ffch-0ffdh 0ffeh-0fffh user rom reserved interrupt vectors reserved nmi vector reset vector page 2 0000h-000fh 0010h-07ffh 1000h-100fh 1010h-17ffh reserved user rom page 3 0000h-000fh 0010h-07ffh 1800h-180fh 1810h-1fffh reserved user rom table 3. eprom memory map ? st63e140,e142,e126,e156, t140,t142,t126,t156 73/82
eprom/otp description. the st63e1xx represents the generic part number for the eprom versions of the st63140, 42, 26, 56 rom products. they are intended for use dur- ing the development of an application, and for pre- production and small volume production. the st63t1xx otp have the same charac- teristics. they both include eprom memory instead of the rom memory of the st631xx, and so the program and constants of the program can be easily modi- fied by the user with the st63e1xx eprom pro- gramming board from sgs-thomson. the rom mask options of the st631xx for osd polarities (hsync, vsync, r, g, b, blank) are emulated with an eprom option byte . this is programmed by the sgs-thomson eprom programming board and its associated software. the eprom option byte content will define the osd options as follows : 70 opt7 opt6 opt5 opt4 opt3 opt 2 opt 1 opt 0 opt7-opt6. device specific bits (1) opt5 : this bit define the blank polarity, if 0 the polarity will be negative if 1 the polarity will be positive.. opt 4 : this bit define the rgb polarity, if 0 the polarity will be negative if 1 the polarity will be positive.. opt 3 : this bit define the osd h/vsync polarity, if 0 the polarity will be negative if 1 the polarity will be positive. opt2-opt0. device specific bits (1) note 1 . device specific bits. these reserved bits must be programmed according to the following ta- ble for their relevant device. from a user point of view (with the following excep- tions) the st63e1xx,t1xx products have exactly the same software and hardware features of the rom version. an additional mode is used to con- figure the part for programming of the eprom, this is set by a +12.5v voltage applied to the test/v pp pin. the programming of the st63e1xx,t1xxis de- scribed in the user manual of the eprom pro- gramming board. on the st63e1xx, all the 7948 bytes of pro- gram memory are available for the user, as all the eprom memory can be erased by exposure to uv light. on the st63t1xx (otp device) a reserved area for test purposes exists, as for the st631xx rom device. in order to avoid any discrepancy be- tween program functionality when using the eprom, otp and rom it is recommended not to use these reserved areas, even when using the st63e1xx. the table 3 is a summary of the eprom/rom map and its reserved area. the reader is asked to refer to the datasheet of the st631xx rom-based device for further details. eprom erasing the eprom of the windowed package of the st63e1xx may be erased by exposure to ultra violet light. the erasure characteristic of the st63e1xx eprom is such that erasure begins when the memory is exposed to light with wave lengths shorter than approximately 4000?. it should be noted that sunlight and some types of fluorescent lamps have wavelengths in the range3000-4000?. it is thus recommended that the window of the st63e1xx package be covered by an opaque label to prevent unintentional erasure problems when testing the application in such an environment. the recommended erasure procedure of the st63e1xx eprom is exposure to short wave ul- traviolet light which haswavelength 2537?. the in- tegrated dose (i.e. uv intensity x exposure time) for erasure should be a minimum of 15 w-sec/cm 2 . the erasure time with this dosage is approximately 15 to 20 minutes using an ultraviolet lamp with 12000 m w/cm 2 power rating. the st63e1xx should be placed within 2.5 cm (1 inch) of the lamp tubes during erasure. sales type opt7-opt6 opt2-opt0 st63e140/t140 0 0 1 0 0 st63e142/t142 0 0 1 0 1 st63e126/t126 0 0 1 0 1 st63e156/t156 0 0 1 0 1 ? st63e140,e142,e126,e156, t140,t142,t126,t156 74/82
absolute maximum ratings this product contains devices to protect the inputs against damage due to high static voltages, how- ever it is advised to take normal precaution to avoid application of any voltage higher than maximum rated voltages. for proper operation it is recommended that v i and v o must be higher than v ss and smaller than v dd . reliability is enhanced if unused inputs are con- nected to an appropriated logic voltage level (v dd or v ss ). power considerations. the average chip-junc- tion temperature, tj, in celsius can be obtained from : tj = t a + pd x rthja where :t a = ambient temperature. rthja = package thermal resistance (junction-to ambient). pd = pint + pport. pint = i dd xv dd (chip internal power). pport = port power dissipation (determinated by the user). symbol parameter value unit v dd supply voltage -0.3 to 7.0 v v i input voltage (afc in) v ss - 0.3 to +13 v v i input voltage (other inputs) v ss - 0.3 to v dd +0.3 v v o output voltage (pa4-pa7, pc4-pc7, da0-da5) v ss - 0.3 to +13 v v o output voltage (other outputs) v ss - 0.3 to v dd +0.3 v v pp eprom programming voltage -0.3 to 13.0 v i o current drain per pin excluding v dd ,v ss , pa6, pa7 10 ma i o current drain per pin (pa6, pa7) 50 ma iv dd total current into v dd (source) 50 ma iv ss total current out of v ss (sink) 150 ma tj junction temperature 150 c t stg storage temperature -60 to 150 c note : stresses above those listed as aabsolute maximum ratingso may cause permanent damage to the device . this is a stress rating only and functional operation of the device at these conditions is not implied. exposure to maximum rating conditions for extended periods may affect device reliability. symbol parameter test conditions value unit min. typ. max. t a operating temperature 0 70 c v dd operating supply voltage 4.5 5.0 6.0 v f osc oscillator frequency run & wait modes 8 8.1 mhz f osdosc on-screen display oscillator frequency 8.0 mhz recommended operating conditions ? st63e140,e142,e126,e156, t140,t142,t126,t156 75/82
the st631xx eeprom single poly process has been speciallydeveloped to achieve 300.000 write/erase cycles and a 10 years data retention. symbol parameter test conditions value unit min. typ. max. v il input low level voltage all i/o pins, kby0-2 0.3xv dd v v ih input high level voltage all i/o pins, kby0-2 0.75xv dd v v hys hysteresis voltage (1) all i/o pins, kby0-2 v dd =5v 1.0 v v ol low level output voltage port b/c, da0-3, bsw0-3, out1, vs, osd outputs, v dd = 4.5v i ol = 1.6ma i ol = 5.0ma 0.4 1.0 v v v ol low level output voltage port a v dd = 4.5v i ol = 3.2ma i ol = 30ma 0.4 1.0 v v v ol low level output voltage osdoscout, oscout v dd = 4.5v i ol = 0.1ma 0.4 v v oh high level output voltage port b/c (2) ,vs v dd = 4.5v i oh = 1.6ma 4.1 v v oh high level output voltage osdoscout, oscout, v dd = 4.5v i ol = 0.1ma 4.1 v i pu input pull up current input mode with pull-up port b/c, kby0-2 v in =v ss (2) 100 50 25 ma i il i ih input leakage current oscin v in =v ss v in =v dd 10 0.1 1 1 0.1 10 m a i il i ih input leakage current all i/o input mode no pull-up osdoscin v in =v dd or v ss 10 10 m a i il i ih input leakage current reset pin with pull-up v in =v ss 50 30 10 m a i il i ih input leakage current afc pin v ih =v dd v il =v ss v ih = 12.0v 1 1 40 m a i oh output leakage current port a, da0-3, bsw0-3 out1, osdout v oh =v dd 10 m a i oh output leakage current high voltage port a, da0-3, bsw0-3 out1 v oh = 12v 40 m a dc electrical characteristics (t a = 0 to +70 c unless otherwise specified) eeprom information ? st63e140,e142,e126,e156, t140,t142,t126,t156 76/82
symbol parameter test conditions value unit min. typ. max. i dd supply current run mode f osc = 8mhz, iload= 0ma v dd = 6.0v 616ma i dd supply current wait mode f osc = 8mhz, iload= 0ma v dd =6v 310ma v on reset trigger level on reset pin 0.3xv dd v v off reset trigger level off reset pin 0.8xv dd v v ta input level absolute tolerance a/d afc pin v dd =5v 200 mv v tr input level relatice tolerance a/d afc pin relative to other levels v dd =5v 100 mv dc electrical characteristics (continued) ? st63e140,e142,e126,e156, t140,t142,t126,t156 77/82
symbol parameter test conditions value unit min. typ. max. t wres minimum pulse width reset pin 125 ns to hl high to low transition time pa6, pa7 v dd = 5v, cl = 1000pf (2) 100 ns to hl high to low transition time da0-da5, pb0-pb6, osd outputs, pc0-pc7, v dd = 5v, cl = 100pf 20 ns to lh low to high transition time pb0-pb6, pa0-pa3, osd outputs, pc0-pc3 v dd = 5v, cl = 100pf 20 ns to h data hold time spi after clock goes low i 2 cbus/s-bus only 175 ns f da d/a converter repetition frequency (1) 31.25 khz f sio sio baud rate (1) 62.50 khz t wee eeprom write time t a =25 c one byte 5 10 ms endurance eeprom write/erase cycles q a l ot acceptance criteria 300.000 >1 million cycles retention eeprom data retention (4) t a =25 c 10 years c in input capacitance (3) all inputs pins 10 pf c out output capacitance (3) all outputs pins 10 pf coscin, coscout oscillator pins internal capacitance(3) 5pf cosdin, cosdout osd oscillator external capacitance recommended 15 25 pf notes: 1.a clock other than 8 mhz will affect the frequency response of those peripherals (d/a, 62.5khz and spi) whose clock is derived from the system clock. 2. the rise and fall times of port a have been reduced in order to avoid current spikes while maintaining a high drive capability 3. not 100% tested 4. based on extrapolated data ac electrical characteristics (t a = 0 to +70 c, f osc =8mhz, v dd =4.5 to 6.0v unless otherwise specified ) ? st63e140,e142,e126,e156, t140,t142,t126,t156 78/82
package mechanical data figure 69. 40 pin ceramic dual-in-line package figure 70. 28-pin ceramic dual-in-line package dim. mm inches min typ max min typ max a a1 b 0.45 .018 b1 c d 50.8 2.00 d1 e 15.2 bsd 0.600 bsd e1 k 13.2 .52 l e1 number of pins n40 dim . mm inches min typ max min typ max a 5.71 .225 a1 0.50 1.78 .020 .070 b 0.40 0.55 .016 .022 b1 1.17 1.42 .046 .056 c 0.22 0.31 .009 .012 d 38.10 1.500 d1 15.2 24.9 .060 .098 e 15.2 bsd 0.600 bsd e1 13.05 13.36 .514 .526 l 3.00 .118 e1 2.29 2.79 .090 .110 6.86 7.36 .270 .290 number of pins n28 ? st63e140,e142,e126,e156, t140,t142,t126,t156 79/82
ordering information to ensure compatibility between the eprom/otp parts and the corresponding rom families, the fol- lowing information is provided. the user should take this information into account when program- ming the memory and osd characters of the eprom parts. communication of the rom codes. to commu- nicate the contents of memories to sgs-thom- son, the customer has to send: one file in intel intellec 8/mds for- mat (either as an eprom or in a ms-dos 5o diskette) for the odd and even osd character osd rom/eeprom one file in intel intellec 8/mds for- mat (either as an eprom or in a ms-dos 5o diskette) for the eeprom initial content (this file is optional) a filled option list form as described in the option list paragraph. the rom code must be generated with st6 as- sembler. before programming the eprom, the buffer of the eprom programmer must be filled with ffh. for shipment to sgs-thomson the eproms should be placed in a conductive ic carrier and packaging carefully. customer eeprom initial contents: format a. the content should be written into an intel in- tellec format file. b. undefined or don't care bytes should have the content ffh. osd test character. in order to allowthe testing of the on-chip osd macrocell the following character must be pro- vided at the fixed 3fh (63) position of the second osd bank. listing generation & verification. when sgs- thomson receives the files, a computer listing is generated from them. this listing refers extractly to the mask that will be used to produce the micro- controller. then the listing is returned to the cus- tomer that must thoroughly check, complete, sign and return it to sgs-thomson. the signed list constitutes a part of the contractual agreement for the creation of the customer mask. sgs-thom- son sales organization will provide detailed infor- mation on contractual points. figure 71. osd test character ? st63e140,e142,e126,e156, t140,t142,t126,t156 80/82
st63e1xx/t1xx microcontroller option list customer: . ...................................................... address: . . . . . . . . . . . . . . . ........................................ contact: . . . .................................................... phone no: . . . . . . . . . . . . . . . . . . ..................................... reference: ....................................................... device [ ] st63e140 [ ] st63e142 [ ] st63e126 [ ] st63e156 [ ] st63t140 [ ] st63t142 [ ] st63t126 [ ] st63t156 temperature range 0 to 70 c for marking one line with 10 characters maximum is possible special marking [ ] no [ ] yes line1 a _ _ _ _ ______o letters, digits, ' . ', ' - ', ' / ' and spaces only the default marking is equivalent to the sales type only (part number). check list: yes no osd code: odd & even [ ] [ ] eeprom code (if desired) [ ] [ ] signature ................................... date ........................................... ? st63e140,e142,e126,e156, t140,t142,t126,t156 81/82
information furnished is believed to be accurate and reliable. however, sgs-thomson microelectronics assumes no responsability for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of sgs-thomson microelectronics. specifications mentioned in this publication are subject to change without notice. this publication supersedes and replaces all information previously supplied. sgs-thomson microelectronics products are not authorized for use as critical components in life support devices or systems without the express written approval of sgs-thomson microelectronics. ? 1994 sgs-thomson microelectronics - all rights reserved. purchase of i 2 c components by sgs-thomson microelectronics conveys a license under the philips i 2 c patent. rights to use these components in an i 2 c system is granted provided that the system conforms to the i 2 c standard specification as defined by philips. sgs-thomson microelectronics group of companies australia - brazil - france - germany - hong kong - italy - japan - korea - malaysia - malta - morocco - the netherlands singapore - spain - sweden - switzerland - taiwan - thailand - united kingdom - u.s.a. sales type rom/eeprom temperature range package st63e140d1 8k (eprom) / 128 bytes 0to +70 c cdip28 st63e142d1 0 to + 70 c cdip28 st63e126d1 0 to + 70 c cdip40 ST63E156D1 0 to + 70 c cdip40 st63t140b1 8k (otprom) / 128 bytes 0to +70 c pdip28 st63t142b1 0 to + 70 c pdip28 st63t126b1 0 to + 70 c pdip40 st63t156b1 0 to + 70 c pdip40 ordering information table ? st63e140,e142,e126,e156, t140,t142,t126,t156 82/82


▲Up To Search▲   

 
Price & Availability of ST63E156D1

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X